Hello, I've a big doubt and I'm sinking in the manual ::)
In the new version of AGS, HOW do I do variables globally accessable?
Or better, a struct globally accessable?
Another thing, stupid but that's annoying me: how do I cast int to strings???
Thanks a lot :o
The way to do it didn't change in the new version (regardless whether you're speaking of 2.8 or 2.72). Export the variable after its declaration, then import it in the header.
Int to string:
Int i=3;
String s=String.Format("%d", i);
Could you make an example? Specifying where the instructions are put?
Thanks
// header
struct mystruct {
int a;
String name;
};
import int var;
import mystruct test[8];
// global script
int var;
mystruct test[8];
export var, test;
Just remember: export only the name, but import the whole declaration.
Thanks! I only knew the infamous GetGlobalInt(... !
;D ;D
In future, READ THE BFAQ (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics) before posting.
Admittedly it doesn't mention structs (it's only 'the basics', after all), but it deals with making other variable types Globally accessable, in detail.
EDIT: I've updated the Inserting variables into speech/messages (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Inserting_variables_into_speech.2Fmessages) entry to also mention ints.