Help with the dialog run script command

Started by arrtisste36, Mon 22/11/2010 21:50:49

Previous topic - Next topic

arrtisste36

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?

Khris

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:

Code: ags
function dialog_request(int p) {
  if (p == 1) {
    // run-script 1
    ...
  }
  if (p == 2) {
    // run-script 2
    ...
  }
  ...
}

monkey0506

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.

SMF spam blocked by CleanTalk