Problem with label.text command

Started by , Mon 07/08/2006 18:58:59

Previous topic - Next topic

RobinMasters

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"...


monkey0506

#1
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)

Ashen

#2
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 ... ;)
I know what you're thinking ... Don't think that.

RobinMasters

Solved.
I had to give the GUI a name, otherwise it wasn't "activated".  ;D
thanks

SMF spam blocked by CleanTalk