Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 17/10/2004 10:53:07

Title: Change global variable
Post by: on Sun 17/10/2004 10:53:07
I need to change the global variable "Fakestreet 13" in a dialog.Can I do it?Or is there any way to check if some dialog option was used on the end and if it was, make Fakestreet 13 change to 1.I need this for my world map.
Title: Re: Change global variable
Post by: Scorpiorus on Sun 17/10/2004 11:07:49
You can only change GlobalInts from within the dialog directly. If you need to change other global variables you have to call a main global script dialog_request function in which you do all the stuff you need:

dialog script:[/u]

@1 // some option
ego: Changing Fakestreet 13...
run-script 500[/b][/i]


main global script:[/u]

function dialog_request(int value) {

Ã,  // if we called dialog_request passing 500 (i.e. run-script 500[/i]):
Ã,  if (value == 500)
Ã,  {
Ã,  Ã,  SetGraphicalVariable("Fakestreet 13", 1);
Ã,  }

}
Title: Re: Change global variable
Post by: Scorpiorus on Sun 17/10/2004 11:27:39
Just open the main global script (Menu > Script > Edit global script...) and put the following lines at the very top of it:

function dialog_request(int value) {

Ã,  // if we called dialog_request passing 500 (i.e. run-script 500):
Ã,  if (value == 500)
Ã,  {
Ã,  Ã,  SetGraphicalVariable("Fakestreet 13", 1);
Ã,  }

}