Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Shade on Fri 09/09/2005 19:54:23

Title: displaying some information on a gui label
Post by: Shade on Fri 09/09/2005 19:54:23
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:


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:


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
Title: Re: displaying some information on a gui label
Post by: monkey0506 on Fri 09/09/2005 22:11:01
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. ;)
Title: Re: displaying some information on a gui label
Post by: GarageGothic on Fri 09/09/2005 23:21:09
I don't know why you would want to repeatedly_execute. Just SetLabelText after randomizing the result.
Title: Re: displaying some information on a gui label
Post by: monkey0506 on Sat 10/09/2005 00:06:44
Oops...yeah, he shouldn't need to repeatedly update the text in that case... :-[



:P :=
Title: Re: displaying some information on a gui label
Post by: Shade on Sat 10/09/2005 10:59:05
thx. now i got used to it. and it is really easy  ;D