Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Mon 07/08/2006 18:58:59

Title: Problem with label.text command
Post by: on Mon 07/08/2006 18:58:59
I've got problems with the new script language of AGS.
When I enter the folowing line
QuotelblStatus.Text = Game.GetLocationName(mouse.x, mouse.y);
for example in the "after fadeIn"-Roomscript, AGS says:
Quoteundefined token "lblstatus
Of course I've created a label with the scriptname "Status"...

Title: Re: Problem with label.text command
Post by: monkey0506 on Mon 07/08/2006 19:02:08
Script o-names aren't automatically assigned to GUIControls (Labels, Buttons, Sliders, etc.).

You set the script o-name by clicking on the Label, then in the GUI Properties window editing the "Script Name" value.

[EDIT:]

Okay, I guess I missed the part "Of course I've created a label with the scriptname "Status"...". Regarding that, are you sure you have set the script name for the Label, and not for the GUI? You have to set the Label's script name in the GUI Properties window, not the "GUI name:" text box.

Also, reading Ashen's post I suppose it's possible you just gave it the name Status, which if you did that then the o-name is Status, not lblStatus.

(and :P for Ashen :D)
Title: Re: Problem with label.text command
Post by: Ashen on Mon 07/08/2006 19:03:16
QuoteOf course I've created a label with the scriptname "Status"...

If it has the scriptname 'Status', you need to use Status.Text, not lblStatus.Text. Unlike GUIs (Characters, Objects - practically everything else in fact), GUI Controls don't get a prefix added to their names (Script-o-name). Some people (me included) add them to the names themselves as a matter of formatting, but it's not actually necessary provided you know what and where each control is.

EDIT: Damn, beaten by monkey_05_06. Had to happen eventually ... ;)
Title: Re: Problem with label.text command
Post by: on Mon 07/08/2006 20:52:37
Solved.
I had to give the GUI a name, otherwise it wasn't "activated".  ;D
thanks