Question regarding SetLabelText

Started by trudgian, Thu 05/05/2005 17:36:34

Previous topic - Next topic

trudgian

I am attempting to put a label on my GUI displaying an integer stored in a GlobalInt. However, as SetLabelText only allows me to set a string and not a variable I am slightly lost. I attempted to get around this by setting a GlobalString in the Global script like so:

SetGlobalString(1,GetGlobalInt(1));

Unfortunately this didn't work. I have read the manual but cannot find antything telling me how to get around this. Can anyone help me?

Scummbuddy

#1
string amount;
amount = GetGlobalInt(1);
SetLabelText(2,3,amount);

maybe? I'm unable to check it, as I am not near my AGS. It may have a problem since I'm not typecasting, though.

------------------------
Sorry, forgot to tell you about:
StrFormat
StrFormat (string destination, string fmt, ...)

Processes the string FMT in the same way as the Display function does (ie. replace %d and %s with values of variables), but instead of displaying it on the screen, puts the result into DESTINATION.
NOTE: You cannot use the DESTINATION string as one of the format arguments, or the results will be unpredictable. (ie. StrFormat(buffer, "%s", buffer); won't work)

Example:

int health=10;
string buffer;
StrFormat (buffer, "%d", health)

will fill buffer with the string representation of the value of health.
See Also: Display
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

trudgian


SMF spam blocked by CleanTalk