Displaying GlobalInts on GUI Labels

Started by Nine Toes, Fri 06/05/2005 09:57:48

Previous topic - Next topic

Nine Toes

Forgive me, for a few things...

1. I looked around the forum for a similar topic, but found none, even though I could have looked a little more at the very least.
2. I don't remember the EXACT codes I used to try and do what I'm trying to do.

See, what I'm trying to do is display a GlobalInt's value on a GUI label.

Here is a rough guess of the code I have at home:
Code: ags

GetGlobalInt(blah);
string buffer;
StrFormat(buffer, "%d", GetGlobalInt(blah));
SetLabelText(1,9,"%d");


Like I said, it's not the EXACT code I used (because I foolishly forgot to write it down before I left my apartment), but I do know that it doesn't work.  I tried a few other methods, but still no result.

The above code is based on the manual's example for StrFormat(), and with the code I have above, all that I get displayed on the GUI's label is "%d".

Can anyone offer me some pointers?  Perhaps educate me a little more about what the code I have written is REALLY doing?
Watch, I just killed this topic...

Gilbert

#1
All okay except one thing (if blah is a well-defined variable with the globalint # in it of course):

GetGlobalInt(blah);
string buffer;
StrFormat(buffer, "%d", GetGlobalInt(blah));
SetLabelText(1,9,buffer);

This is nowhere technical, so I'll move it to the beginners' forum.

Edited: Just noticed, the first GetGlobalInt() is useful for nothing, so I crossed it away.

Nine Toes

Jolly good.Ã,  I'll try it as soon as I get home.

I appreciate it, because I don't really understand too much about string functions and command, therefore, I don't really know how they work.

Thank you very much... and sorry about posting in the wrong forum, I guess I wasn't thinking.

~Mr. Hyde
Watch, I just killed this topic...

TerranRich

The variables section in the BFAQ might help you a bit, as well as the "GlobalInts, your friend" section. Too lazy to direct link to them right now. :P
Status: Trying to come up with some ideas...

Nine Toes

No need to give me the link, it's in your sig, you shilly sit! ;)  Thanks anyway, man.  BTW, the BFAQ was a big help.

I did what Gilbot told me, and I replaced the %d with buffer, and the code now works just peachy.  And after a little tinkering, I figured out exactly what I was doing.
Watch, I just killed this topic...

SMF spam blocked by CleanTalk