Help with variables and values

Started by , Mon 06/10/2003 13:27:38

Previous topic - Next topic

Nick

Ok so I have my variable, it's set to 100. It's supposed to be global.

// room script file
int global_1 = 100;

When I try to put it in global script, it doesn't work. And when I deduct points in the current room and then try to go to the next room, the game errors. What am I doing wrong?

jetxl

it's SetGlobalInt( 1 , 100 ) ;
and SetGlobalInt( 1 , GetGlobalInt(1) - 1 ) ;
try this


Nick

Is that going in the room script or global script? I tried each one but I guess I don't know where to put them..

Gilbert

Whereever you think it's appropiate. These "global ints" are accessible in both room scripts and the global script.

Nick

Thanks guys.

Now what if I wanted the variable to be displayed, sort of like health? Would I put it in a GUI? And if I do, how?

Ishmael

Make a GUI label where you want the number to be displayed... Lets say we have gui named "HBAR" and object number 0, and the healt is globalint 3 here.

in start of global script:

string healthtxt;

in global rep_ex:

StrFormat(healthtxt, "%d", GetGlobalInt(3));
SetLabelText(HBAR,0,healthtxt);

;)
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk