displaying some information on a gui label

Started by Shade, Fri 09/09/2005 19:54:23

Previous topic - Next topic

Shade

i am working on a little "fighting engine" and i want to display some information on a gui. e.g. how many damage ego or his oponent makes, do they hit each other or do they miss, ...
the problem is i don't know how to get these information on a gui label.

i have e.g. something like that:

Code: ags

ran_damage=Random(es_damage);
[...]
if(ran_damage==0){ damage=1;}
[...]


and now i want to display the "damage" on a gui label. e.g. "value of damage(here: 1)" damage. but how can i do that.
the same thing i wanted to do with this:

Code: ags

ran_hit=Random(es_hit);
[...]
if(ran_hit==0){ hit=1;} //means the char hits
if(ran_hit==1){ hit=0;} //means the char misses
[...]


here i want to display: if hit=0 -> "hit" , if hit=1 -> "miss" but again i don't know how.

in haven't found something in the manual so please help me. thx

monkey0506

Look for Label.SetText (AGS v. 2.7+) or SetLabelText (v. 2.62-).  And repeatedly_execute.  In the manual.  If you need more help, ask away, but it should be pretty obvious.  To put the integer into the string you can use %d with Label.SetText.  Not sure if you can with SetLabelText, but if you can't, then look up StrFormat. ;)

GarageGothic

I don't know why you would want to repeatedly_execute. Just SetLabelText after randomizing the result.

monkey0506

Oops...yeah, he shouldn't need to repeatedly update the text in that case... :-[



:P :=

Shade

thx. now i got used to it. and it is really easy  ;D

SMF spam blocked by CleanTalk