Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arrtisste36 on Mon 22/11/2010 21:50:49

Title: Help with the dialog run script command
Post by: arrtisste36 on Mon 22/11/2010 21:50:49
I guess I'm not really sure how to use it. I read somewhere that you are supposed to match the number after the run script command with the parameter in the dialog request function, but I keep getting a parse error.  Can someone please help me?
Title: Re: Help with the dialog run script command
Post by: Khris on Mon 22/11/2010 22:02:12
First off, you don't really need it anymore since you can now use standard script commands directly in a dialog script. Just put a blank space in front the command.

Regarding your question:
Say you wrote "run-script 1".
This will make AGS call dialog_request(1);

Accordingly you'll need a function that looks like this:

function dialog_request(int p) {
  if (p == 1) {
    // run-script 1
    ...
  }
  if (p == 2) {
    // run-script 2
    ...
  }
  ...
}
Title: Re: Help with the dialog run script command
Post by: monkey0506 on Mon 22/11/2010 22:16:46
For future reference, if you're getting an error, you should let us know where the error is coming from. Parse errors will tell you not only the script, but the line in the script as well (or at least "Near ...").

If you see an error message you can press Ctrl+C to copy it to the clipboard and then paste it here.

Also interesting to note is that although dialogs now allow normal scripting commands making run-script/dialog_request pretty obsolete..AGS now requires dialog_request to exist within GlobalScript.asc (and will create it if it doesn't) if any dialogs exist.