Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bleckman1974 on Mon 21/11/2005 17:53:45

Title: Change Text on GUI Label with a Button
Post by: Bleckman1974 on Mon 21/11/2005 17:53:45
Ok, I have GUI:

It has two separate Dials

one Changes one GUI label, the other changes the other GUI label

like "blah blah"
      "xxxxxxxx"
      "jjjjjjjjjjjjjjj"
on one
and the other has diferent "lables"

i went to change each one with the dials
I've tried "SetLablelText" and it won't work
I'm using AGS 2.71 RC3
Title: Re: Change Text on GUI Label with a Button
Post by: Ashen on Mon 21/11/2005 18:18:10
This should probably be in Beginners Tech, as the answer is in the manual. Looking up SetLabelText will get you:

Quote
Text property (label)
(Formerly known as SetLabelText, which is now obsolete)
(Formerly known as Label.GetText, which is now obsolete)
(Formerly known as Label.SetText, which is now obsolete)

String Label.Text;

Gets/sets the text displayed in the specified label. This allows you to change the text during the game, for example to create a Lucasarts-style status line.

So:

myLabel.Text = "blah blah";



The rest (the 'different labels for different values' bit) is all about variables - which are probably in the manual and certainly in the BFAQ.
Title: Re: Change Text on GUI Label with a Button
Post by: Bleckman1974 on Mon 21/11/2005 18:24:18
SetLabelText Is oblsolete, yes I am aware of that.

i Read the manual

that's why i asked for Help.

those commands are obsolete

I searched and evey post used the OLD AGS commands

Title: Re: Change Text on GUI Label with a Button
Post by: Ashen on Mon 21/11/2005 18:38:32
That quote is from the manual and shows the right thing to use to change a label's text - the String Label.Text property. If you go to that entry, or look at the code I gave you, you'll see the correct way to use it.

My point was, if you look up SetLabelText you will be linked to that entry - which tells you that Label.Text has replaced the 3 obsolete (as of 2.71) commands SetLabelText, Label.GetText and Label.SetText.

And yes, most posts will use older AGS codes, because 2.71 is still in beta, so not as many people use it.
Title: Re: Change Text on GUI Label with a Button
Post by: Bleckman1974 on Tue 22/11/2005 01:11:35
OK I Got it, i understand it now

I just tend to OVER-THINK thinks and mak them more Diffucult then what they realy are, AGS's Script Language is so easy even a caveman could do it LOL.