Change global variable

Started by , Sun 17/10/2004 10:53:07

Previous topic - Next topic

Tuntis

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.

Scorpiorus

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);
Ã,  }

}

Scorpiorus

Just open the main global script (Menu > Script > Edit global script...) and put the following lines at the very top of it:

Code: ags
function dialog_request(int value) {

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

}

SMF spam blocked by CleanTalk