inputboxs with dialogs. (Merged topic)

Started by Terminator, Tue 13/05/2003 03:09:52

Previous topic - Next topic

Terminator

Note from moderator:
Because the two threads "inputboxs with dialogs." and "Illegal Exception for Chris Jones" are related, they're now merged into one single topic.


All right, in one of my dialogs I would like to have it so that a character would ask a question and then a input box would come up and you type in the answer and then the program would compare the answer with the correct one, and then display a correct or non correct text answer.

 Now I used InputBox command and then a STRCaseComp command, in the dialog_request function but when I run the game, there is no inputbox, but it just returns to the dialog options...

What gives?

Thanks in advance.

Terminator

I wanted to set up in my game a global variable SetGlobalInt in the global script.  Then in the dialog goto dialog_ request and then change the value of the variable.  I did it just like the demo, and I even tried just a normal variable quiz = 0; But this error comes up, crashing the game:

Illegal Exception

 An exception 0xC0000005 occured in ACWIN.EXE at
EIP = 0x0041CB27;  program pointer is +72, ACI version 2.53.487, gtags (0,6)

Then it tells me to contact CJ at the Tech Forum.

So whats wrong?

Thanks for the help.

Gilbert

Hmmm can you post your dialog_request() script here?

cornjob

In theory, what you did should work. Are you sure you've implemented dialog_request correctly? If you can you post your dialog_req script, maybe we can figure out the problem.

Ishmael

I'd like the see the dialog script too, if its not so secret....
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman

Yes, can you post that script, and also the script where you declared the variable.

Terminator

OK, there you go, but today I guess, the game felt like changing the error message, today its:

Error: DoDialog: all options have been turned off.


// main global script file

function game_start() {
 // called when the game starts, before the first room is loaded
SetGlobalInt (18,0);
}


function dialog_request (int cond) {
 if (cond == 1) {
   
   }
 if (cond == 2) {
   string sinbad;
   InputBox("Answer:", sinbad);
   if (StrCaseComp("7", sinbad)==0) {
    DisplaySpeech(ANT, "You are right!");
    }
  }  
 if (cond == 10) {
   SetGlobalInt(18,1);
  }

}


Dialog script:

@16  // option 16
ant: "Some text here"
ant: "some text here"
goto-dialog 10
stop

I hope this helps!

Thanks.

Terminator

O.k. heres the code:

Dialog code:

@14  // option 14
ant: "Text here."
ant: "Question 4:"
goto-dialog 2
return


function dialog_request (int cond) {
 if (cond == 1) {
   
   }
 if (cond == 2) {
   string sinbad;
   InputBox("Answer:", sinbad);
   if (StrCaseComp("7", sinbad)==0) {
    DisplaySpeech(ANT, "You are right!");
    }
  }  
 if (cond == 10) {
   SetGlobalInt(18,1);
  }

}

So, I hope this helps.

Thank you.

Gilbert

Hmmm you never run the dialog_request() function in your dialog script, unless that's just a small portion of your dialog script.

In that case, the crash was probably caused by calling a non-existing dialog topic (topic 10), while what you really wanted to do was to run-script 10 there. If my guess is correct, you should do it like:

Dialog script:

@16  // option 16
ant: "Some text here"
ant: "some text here"
run-script 10
stop


PS: actually you don't need that "SetGlobalInt (18,0);" in game_start() as all Global Ints were initially set to 0 at game start already.

Gilbert

Ah I just replied to your other thread, and the answer is obvious now, change also this portion:

Dialog code:

@14  // option 14
ant: "Text here."
ant: "Question 4:"
run-script 2
return

Don't get goto-dialog and run-script mixed up, goto-dialog is used to switch to another dialog topic while run-script is used to invoke the dialog_request() function.

Ishmael

QuoteError: DoDialog: all options have been turned off.

You have too many option-off's in there... you must have at least 1 dialog opiton on, and it end in stop
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

hmmm his problem seems quite obvious now.

I think I'll merge the 2 topics.

Terminator

Duhhh...  Well, it all works now, thanks everyone for the help.

Terminator

SMF spam blocked by CleanTalk