Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Akumayo on Fri 09/07/2004 21:21:58

Title: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Akumayo on Fri 09/07/2004 21:21:58
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!!!
Title: Re: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Moox on Fri 09/07/2004 22:23:23
You will have to use SetLabelText() and format str
Title: Re: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Scorpiorus on Fri 09/07/2004 22:33:18
I believe the @GIx@ thingy only works with global messages.
It's actually a good idea to make them working with a label too.
Title: Re: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Akumayo on Sat 10/07/2004 04:04:09
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
Title: Re: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Scorpiorus on Sat 10/07/2004 12:16:58
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"
Title: Re: @GIX@ on a GUI, pulls a disappearing act!!!
Post by: Akumayo on Tue 13/07/2004 00:09:47
Thanks, now everything can be displayed

PS- thnx again!!