Hi everybody.
I have read the manuel but did'nt find any answer (and as I'm french, it's quite hard to me to understand everything).
I would like to let the player enter a name for his character, and I have created a GUI with a text box.
Now I want to display the name in another GUI label.
But I can't find the code to get the text box content and put it in the label.
Can you help me please ? ???
It depends a little on what version of AGS you're using, since the commands have had their names changed a few times. For V2.71+ you need to use TextBox.Text (http://www.adventuregamestudio.co.uk/manual/TextBox.Text.htm) and Label.Text (http://www.adventuregamestudio.co.uk/manual/Label.Text.htm%5B/url), for V2.7 it's TextBox.GetText and Label.SetText, earlier than that use GetTextBoxText and SetLabelText. Hopefully, the appraopriate manual entries will help.
I have the 2.71.631 version.
I have found the Textbox.Text and Label.Text in the manual, but I don't know how to write the code precisely to put the TextboxText in the Label.Text... :-\
I have tried this :
String charname = TextBox.text ;
LabelText = charname;
... but it does'nt work. I'm not very good in using the script code yet...
You need to have given the Label and TextBox script-names in the editor, then you use (name).Text. So, if the TextBox was called MyText and te Label is MyLabel, you'd use:
String charname = MyText.Text;
MyLabel.Text = charname;
Be careful of the capitalisation - MyText.Text will work, MyText.text won't.
Also, unless you're keeping the text for use somewhere else, you should be able to copy it directly, without using the String:
MyLabel.Text = MyText.Text;
But, if you're using this text for a character name, you might want to store it somewhere else as well (like to the Character.Name property (http://www.adventuregamestudio.co.uk/manual/Character.Name.htm), e.g. cEgo.Name = MyText.Text;).
Thank you very much, I'll try :)
Edit : It works ! Thank you very much. I'm too stupid ^^ :P