Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: JpGames on Fri 30/03/2007 23:03:22

Title: Show variable values in a custom GUI
Post by: JpGames on Fri 30/03/2007 23:03:22
I want know if i can show the value of one variable (for example, graphicalvariable("one")) in my custom GUI. I tryed with %d. , @ in the labels and it do not work. I look for some relaten threads in the past but i do not find nothing usefull. I tried with this script in the repeteadly_execute:

   int TotalDisparos = GetGraphicalVariable("disparos");
   String lblDisparos;
   lblDisparos.Text = String.Format("Disparos: %d", TotalDisparos);

And then i write @lblDisparos in the text message of the label but it do not works neither. It give the error message: 'Text' is not a public member of 'string'. I erased text, but the GHI is only showing "@lblDisparos"  ???

Thanks again for your patience

JpGames

EDIT I were looking for hours and i found 3 or 4 threads about how to show variables in a custom GUI, but some ones are very old (2004) Anyway, all them speak about lblXXX.Text, but it give me an error (text is not a public member of string) Must i declare lblXXX first? Im becoming crazy trying to solve this  ::)
Title: Re: Show variable values in a custom GUI
Post by: Pumaman on Sat 31/03/2007 14:08:25
Quote from: JpGames on Fri 30/03/2007 23:03:22
   int TotalDisparos = GetGraphicalVariable("disparos");
   String lblDisparos;
   lblDisparos.Text = String.Format("Disparos: %d", TotalDisparos);

Remove the "String lblDisparos;" line, and make sure that the GUI Label that you want to dispaly the text on has its Script Name set to "lblDisparos".
Title: Re: Show variable values in a custom GUI
Post by: JpGames on Sat 31/03/2007 20:51:58
Im so stupid sometimes. I did not look at that before; my label name were "new label"  :-X I did exactly what you said and now is working perfect  ;D

Thanks again, this forum is helping me a lot to improve with the AGS very quickly.

JpGames