Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Konador on Mon 26/07/2004 19:45:54

Title: Setting variables during dialogue?
Post by: Konador on Mon 26/07/2004 19:45:54
I have written a dialog, but after one specific line in the conversation I want to set the global variable "clue given" to "1".

I have got "run-script 1" in the dialog to call this from the global script:

function dialog_request (int 1) {
    ???
  }

But what do I type in the dialogue_request to change the variables?
Title: Re: Setting variables during dialogue?
Post by: Mr Flibble on Mon 26/07/2004 19:48:19
function dialog request (int param) {

if (1==param) {
//code here
}
}
Title: Re: Setting variables during dialogue?
Post by: Konador on Mon 26/07/2004 19:59:18
Ah thanks for the correction! :) What is the code for changing a variable? I can't find it in the help file.
Title: Re: Setting variables during dialogue?
Post by: on Tue 27/07/2004 01:03:33
Let me warn you, it's a good thing I'm in a great mood. Most people would yell at you to read the manual. Here's the script, woah, wait, its a global variable???

For a variable, it would go like this:

clue=1;

But as far as I know you can't name Global Variables. But, the script for them goes like this:

SetGlobalInt(int globalvar, int value);

Where "int globalvar" is replaced with the # of your Global Variable, and "int value" is replaced with the value you wish to assign to your variable.
Title: Re: Setting variables during dialogue?
Post by: Konador on Tue 27/07/2004 01:11:12
Thanks :)

I did read the manual but I still couldnt find it, but now I know why I couldnt find it. I had created the variable using the AGS interface, so I needed to use SetGraphicVariable, which I didnt know. It explains why searching for variable in the manual didn't help at all :P I've done it now tho, and my game's coming along nicely :)