Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 13/08/2006 15:54:01

Title: How to display a GI value on a label?
Post by: on Sun 13/08/2006 15:54:01
How can I display the value of a GlobalInt on a label?
For exampel the GI 7 on label "lblPoints"
Title: Re: How to display a GI value on a label?
Post by: GarageGothic on Sun 13/08/2006 16:23:45
String labeltext = String.Format("%d", GetGlobalInt(7));
lblPoints.Text = labeltext;

Title: Re: How to display a GI value on a label?
Post by: on Sun 13/08/2006 17:02:07
I entered
Quote
  // script for Room: Player enters room (before fadein)

String labeltext = String.Format("%d",GetGlobalInt(7));
nigeriaSpTore.Text = labeltext;

SetGlobalInt(7,5);

but the value remains 0
Title: Re: How to display a GI value on a label?
Post by: TheMagician on Sun 13/08/2006 17:25:14
I would say you have to set the GlobalInt before you update the label string.

Everytime you change the value of the GlobalInt you have to update your label accordingly.
Title: Re: How to display a GI value on a label?
Post by: FSi++ on Sun 13/08/2006 17:54:46
Or put this in repeatedly_execute():

String labeltext = String.Format("%d",GetGlobalInt(7));
nigeriaSpTore.Text = labeltext;


So it will be updated automagically
Title: Re: How to display a GI value on a label?
Post by: on Sun 13/08/2006 20:00:40
Thanks

I've set an array instead of a GI, but  how can I add 3 Points? (not set 3 Points)

Quote
  // script for Hotspot 1 (Hotspot 1): click at hotspot
 
Punkte[0] = 3;
Title: Re: How to display a GI value on a label?
Post by: GarageGothic on Sun 13/08/2006 21:26:34
Punkte[0] = Punkte[0] + 3;
Title: Re: How to display a GI value on a label?
Post by: strazer on Sun 13/08/2006 23:39:07
Quote from: GarageGothic on Sun 13/08/2006 16:23:45
String labeltext = String.Format("%d", GetGlobalInt(7));
lblPoints.Text = labeltext;


Or just
  lblPoints.Text = String.Format("%d", GetGlobalInt(7));

;)