Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Terminator on Tue 13/05/2003 03:09:52

Title: inputboxs with dialogs. (Merged topic)
Post by: Terminator on Tue 13/05/2003 03:09:52
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.
Title: Illegal Exception to Chris Jones!
Post by: Terminator on Tue 13/05/2003 06:52:19
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.
Title: Re:Illegal Exception to Chris Jones!
Post by: Gilbert on Tue 13/05/2003 07:08:17
Hmmm can you post your dialog_request() script here?
Title: Re:inputboxs with dialogs.
Post by: cornjob on Tue 13/05/2003 12:52:08
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.
Title: Re:inputboxs with dialogs.
Post by: Ishmael on Tue 13/05/2003 16:13:07
I'd like the see the dialog script too, if its not so secret....
Title: Re:Illegal Exception to Chris Jones!
Post by: Pumaman on Tue 13/05/2003 19:49:10
Yes, can you post that script, and also the script where you declared the variable.
Title: Re:Illegal Exception to Chris Jones!
Post by: Terminator on Wed 14/05/2003 02:17:41
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.
Title: Re:inputboxs with dialogs.
Post by: Terminator on Wed 14/05/2003 02:23:35
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.
Title: Re:Illegal Exception to Chris Jones!
Post by: Gilbert on Wed 14/05/2003 02:46:13
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.
Title: Re:inputboxs with dialogs.
Post by: Gilbert on Wed 14/05/2003 02:50:35
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.
Title: Re:Illegal Exception to Chris Jones!
Post by: Ishmael on Wed 14/05/2003 06:28:36
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
Title: Re:Illegal Exception to Chris Jones!
Post by: Gilbert on Wed 14/05/2003 06:34:10
hmmm his problem seems quite obvious now.

I think I'll merge the 2 topics.
Title: Re:inputboxs with dialogs. (Merged topic)
Post by: Terminator on Thu 15/05/2003 02:26:41
Duhhh...  Well, it all works now, thanks everyone for the help.

Terminator