Setting variables during dialogue?

Started by Konador, Mon 26/07/2004 19:45:54

Previous topic - Next topic

Konador

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?

Mr Flibble

function dialog request (int param) {

if (1==param) {
//code here
}
}
Ah! There is no emoticon for what I'm feeling!

Konador

Ah thanks for the correction! :) What is the code for changing a variable? I can't find it in the help file.

monkey0506

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.

Konador

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 :)

SMF spam blocked by CleanTalk