forum.boolean.name

forum.boolean.name (http://forum.boolean.name/index.php)
-   Основной форум (http://forum.boolean.name/forumdisplay.php?f=49)
-   -   Question from holland :) (http://forum.boolean.name/showthread.php?t=8170)

Snaak 09.04.2009 11:33

Question from holland :)
 
Hi guys :)

I have a question for you, I've been altering the multiline source to make a nice game about hacking, its a sort of a simulator like in the movies where you will have to buy programs, hack in to banks, that kind of thing. I am trying to make a procedure I can just call upon to keep the source code as little as possible, so as you can see procedures gamescreen are questions you can answer, and procedure gamescreen tells what is happening.

Everything seems to be working fine in the emulator, however when I put the compiled java on my Sagem 300c phone after the second question it just shows the storyscreen very shortly and skips trough it right away.

I do not know why that is, I can only guess that it is because the previous click is still in memory?

Код:

program HackGame;
uses text;

var option1, option2 : integer;
    play, clicked : command;   
    optie1, optie2, verhaal : string;
                key: integer;
                schaambef: integer;

procedure question (optie1, optie2: string);
        begin
  ShowMenu('Select a game', CH_IMPLICIT);
   
  option1 := MenuAppendString(optie1);
  option2 := MenuAppendString(optie2);

  play := CreateCommand('Play', CM_SCREEN, 1);
  AddCommand(play);

  repeat Delay(100); until GetClickedCommand = play;
end;

procedure gamescreen (verhaal: string);
        begin
          showCanvas;
                text.init;
                text.set_text_par(10, 10, getWidth-10, getHeight-10, 1, 16, 2, 64,verhaal);
                setColor(128,255,0);
                fillRect(0,0,GetWidth,GetHeight);
                setColor(0,128,64);
                text.draw_mult_str;
                Repaint; Delay(100);
                repeat
                setColor(128,255,0);
                fillRect(0,0,GetWidth,GetHeight);
                setColor(0,128,64);
                text.draw_mult_str;
                Repaint; Delay(100);
                key:=KeyToAction(GetKeyPressed);
                if key=GA_UP then text.Mode_Up;
                if key=GA_DOWN then text.Mode_Down;
                if key=GA_LEFT then text.Page_Up;
                if key=GA_RIGHT then text.Page_Down;
                if key=GA_FIRE then schaambef := 1;
        Delay(100); until schaambef = 1;               
        schaambef := 0;
end;


begin
gamescreen ('blablablablablabla.');
question ('hello there', 'question here');
gamescreen ('another question here');
question ('hello again', 'option two question');
end.

I really need your genius russian coolness here, help a dutch guy out. ;)

Phantom 09.04.2009 15:29

Ответ: Question from holland :)
 
I have not understood sense of your message. You use the translator (google)? It works as "broken phone". Try to write in native dutch language, and I will try to translate through google. =)

Romanzes 09.04.2009 16:54

Ответ: Question from holland :)
 
По поводу Sagem'ов ничем не могу помочь. Хотел только сказать, что переменная schaambef у тебя явно лишняя. Я бы переделал код вот так:
Код:

program HackGame;
uses text;

var option1, option2 : integer;
    play, clicked : command;   
    optie1, optie2, verhaal : string;
                key: integer;

procedure question (optie1, optie2: string);
        begin
  ShowMenu('Select a game', CH_IMPLICIT);
   
  option1 := MenuAppendString(optie1);
  option2 := MenuAppendString(optie2);

  play := CreateCommand('Play', CM_SCREEN, 1);
  AddCommand(play);

  repeat Delay(100); until GetClickedCommand = play;
end;

procedure gamescreen (verhaal: string);
        begin
          showCanvas;
        text.init;
        text.set_text_par(10, 10, getWidth-10, getHeight-10, 1, 16, 2, 64, verhaal);
        setColor(128,255,0);
        fillRect(0,0,GetWidth,GetHeight);
        setColor(0,128,64);
        text.draw_mult_str;
        Repaint; Delay(100);
        while true do begin
                setColor(128,255,0);
                fillRect(0,0,GetWidth,GetHeight);
                setColor(0,128,64);
                text.draw_mult_str;
                Repaint; Delay(100);
                key:=KeyToAction(GetKeyPressed);
                if key=GA_UP then text.Mode_Up;
                if key=GA_DOWN then text.Mode_Down;
                if key=GA_LEFT then text.Page_Up;
                if key=GA_RIGHT then text.Page_Down;
                if key=GA_FIRE then break;
                Delay(100);
        end;               
end;


begin
gamescreen ('blablablablablabla.');
question ('hello there', 'question here');
gamescreen ('another question here');
question ('hello again', 'option two question');
end.

Надеюсь, я ничего не напутал с синтаксисом, так как давно уже не пользовался Midlet Pascal'ем.


Часовой пояс GMT +4, время: 01:22.

vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot