Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: JpGames on Sat 24/03/2007 12:37:25

Title: Graphical variables into a dialog script
Post by: JpGames on Sat 24/03/2007 12:37:25
I were using the graphical variables to determinate some actions in the game as simple interruptors (for example: if ItalkedwithBilly == 0 nothing happens...) was easy since i do not need write script lines because i was able to chage it values in the interaction editor.

But now i saw that in te dialog scripts i just can change the global variables but not the graphical variables. Setglobalint do not work with Italkedwithbilly, i guess because its a different kind of variable. But, which is the difference? Are not both Integers ? Im really confused with this now. I read the tutorials and i can find the difference. Which use could have the global int's?

Also, i need know how i can change graphical variables inside a dialog script.

Thanks for any help.

JPGames.
Title: Re: Graphical variables into a dialog script
Post by: Ashen on Sat 24/03/2007 14:34:40
There's a bit of clarifcation about the differences, and the Pros and Cons of each 'type' of variable in this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=30140.0).

To change Graphical Variables in dialog script, read the BFAQ Entry Running regular code inside dialogs (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Running_regular_code_inside_dialog), and look up SetGraphicalVariable (http://www.adventuregamestudio.co.uk/manual/SetGraphicalVariable.htm) and GetGraphicalVariable (http://www.adventuregamestudio.co.uk/manual/GetGraphicalVariable.htm) for if (ItalkedwithBilly == 0) type checks. (Personally, I wouldn't use Graphical Variables EVER - I avoid the Interaction Editor and it's workings as much as possible and recommend everyone else does as well.)
Title: Re: Graphical variables into a dialog script
Post by: JpGames on Sat 24/03/2007 21:42:55
Well, i read all that and know i have more clear some things, but another ones looks difficult to understand (my english is not enouhg good). Basically: where i must declare the custom variables to make it valid in all the program?, and, could i use two diferent type of parameters inside the dialog_request function? something like

function dialog_request(int parameter AND string namevariable) {
     SetGraphicalVariable(namevariable, 1)
};

It works? Or maybe im doing something wrong?

JpGames
Title: Re: Graphical variables into a dialog script
Post by: Ashen on Sat 24/03/2007 23:34:46
First question (where to declare variables): It depends. If the variable just needs to be used in a Room script, declare it in the Room script. If it just needs to be used in the Global script, declare it in the Global script. If it needs to be used in Global and Room scripts or across a couple of Rooms (which I guess you mean by "valid in all the program"), it's declared in the Global script and exported, then imported in the Script Header. (This is also in the BFAQ (http://www.americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics).)

Second question (dialog request): No, that's not how it works. Take another look at the BFAQ entry, and search the forums. The dialog script command run-script x only allows one parameter (the x), adding any to the function declaration will only lead to errors. It'd be more like:

function dialog_request(int parameter) {
if (parameter == 1) {
   SetGraphicalVariable(ItalkedwithBilly, 1);
  }
}


Side note, to anyone reading this: What is it about dialog_request people have such problems with? Between the BFAQ and the manual, I don't see where it could get much clearer, and yet...
So, how could the BFAQ entry be made clearer? PM me if you have any suggestions, please.
JpGames, sorry for the minor thread-jack but it seemed appropriate. Everyone else please stay on topic.

Title: Re: Graphical variables into a dialog script
Post by: JpGames on Sun 25/03/2007 02:02:50
Thanks for the help. I guess my trouble is sometimes the language. Its difficult to read technical issues in a foreign language. You can be sure that im doing my best to do not make questions before i tried it by myself and read all i can.

Just one last thing; how many different values could have the dialog_request? I mind, i could use it as many times i want?

for example:

function dialog_request(int parameter) {
if (parameter == 1) {
   SetGraphicalVariable(ItalkedwithBilly, 1);
  }
.....
if (parameter == 3782) {
   (code)
}

Is valid? Or there are a limited number of values for parameter? Im almost sure i do not read nothing about it in the tutorials, so i guess parameter could be any value valid for integer.

thank you again.

JpGames
Title: Re: Graphical variables into a dialog script
Post by: Ashen on Sun 25/03/2007 11:50:23
Well, the maximum value for an int is 2,147,483,647 (according to the manual). The maximum number of values you can have in dialog_request might be lower than that (I have a vague memory of there being a limit, but I can't find any reference to it either), but if so it's still high enough that it should never be a problem.