Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 18/07/2004 18:33:13

Title: Problem with run-script in dialogs
Post by: on Sun 18/07/2004 18:33:13
Hi again, I don't know if you remember me. I contributed a game about a year or two ago,  and now I've decided to try again.

Immediately, there was a problem. The run-script function in dialogs, apparently, refuses to work.  What exactly happens is, I type out "run-script 2" for example, and then go add the function in the global script, just like this;

function dialog_request (2) {
    ChangeCharacterView (EGO, 12);
  }

Now, what happens is that when I save the game, I get a parse error at the "2". I change it to some other number, and still parse error. As far as I understand, it's supposed to be a number there, but it just doesn't seem to accept that.
Title: Re: Problem with run-script in dialogs
Post by: Kweepa on Sun 18/07/2004 19:10:19
There should be one dialog_request function in the global script, and it should go a little something like this:

function dialog_request(int value) {
  if (value == 2) {
    ChangeCharacterView(EGO, 12);
  }
  else if (value == 42) {
    ...
  }
  else if (value == 314) {
    ...
  }
  // add other values here
}

Title: Re: Problem with run-script in dialogs
Post by: TerranRich on Mon 19/07/2004 05:45:56
This is clearly explained in the Beginners' FAQ. Read it.