In my game, I need a character's life displayed on a GUI, in the GUI's label, I have written Life= @GI7@ / @GI8@
Unfortunately, during the game, the GUI reads, Life= /
I have tried other methods, that work to display this, but I really need to know why this one won't work, and more importantly, how to fix it!!!
You will have to use SetLabelText() and format str
I believe the @GIx@ thingy only works with global messages.
It's actually a good idea to make them working with a label too.
I used the SetLabelText() and the str's, but I need more than just life displayed, and when I add the extra lines of script, I get a "stack overflow" error.....
Thanks for the tip about Global Messages though, I guess it makes sense that @GI7@ would be blank since there is no GLobal Message 7, teh hee
Quote from: Akumayo on Sat 10/07/2004 04:04:09I used the SetLabelText() and the str's, but I need more than just life displayed, and when I add the extra lines of script, I get a "stack overflow" error.....
You can use a %d token to display as many global ints as you want:
Instead of Life= @GI7@ / @GI8@ we have:
main global repeatedly execute script:string
labelText;
StrFormat(
labelText, "Life =
%d / %d",
GetGlobalInt(7),
GetGlobalInt(8 ));
SetLabelText(GUI, LABEL,
labelText);
See, the first %d is replaced with globalint7 and the 2nd with globalint8.
QuoteThanks for the tip about Global Messages though, I guess it makes sense that @GI7@ would be blank since there is no GLobal Message 7, teh hee
No-no, @GI7@ doesn't display a global message number 7. I meant that you can have a global message with the @GIx@ token within its text so it will be replaced with an actual value:
"This is my global message. GlobalInt7 holds @GI7@"
So if you display that message and global int is set to 10 it will display:
"This is my global message. GlobalInt7 holds 10"
Thanks, now everything can be displayed
PS- thnx again!!