Hello,
I need to use some Variables for my intro. How can I define, and use them? Actually I use the gamescore for this, but I think this is rather stupid, because there also have to be other Variables.
Here is a peace of my script, with the gamescore as virable:
if (game.score == 1) {
GiveScore (1);
DisplayMessage (7);
Wait (64);
DisplayMessage (8);
Wait (50);
NewRoomEx (4, 361, 180);
}
if (game.score == 3) {
GiveScore (1);
DisplayMessage (10);
Wait (62);
DisplayMessage (11);
Wait (57);
DisplayMessage (12);
Wait (80);
NewRoomEx (4, 362, 163);
}
Can you tell me (or simply edit my example) how I have to use a "real" variable?
int varName;
int otherVarName;
varName = 1;
otherVarName = 17;
And so on... or you can just use
int varName = 1;
basic template is as follows
(type) (name);
or
(type) (name) = (value);
:o Thank you for that quick answer
Is there a way, to define variables, so that they are available in every room?
Quote from: Shadow on Wed 19/11/2003 18:17:41
Is there a way, to define variables, so that they are available in every room?
Set them up in your global script. At the very very top, then it should be available everywhere...
You can define a var at the top of the global script (e.g int x;) and then youhave to put import x; in the script header (it's a seperate file in the script menu) I'm not wuite sure if it's import x; or import int x; or something, but anyway, the other method is to put SetGlobalInt(1,0); in the game_start function (or anywhere else basically) though it's rather pointless as the initial value is 0 anyway. but you could, like, put SetGlobalInt(1,3); (i.e setting the first global int to a value of 3) and then in another room you use if (GetGlobalInt(1) == 3) {
//something happens
}
:)
thanks, for your help, I'll try it.