Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help: Name Not Defined Within Scope

Whitellama Rugani
Registered User
Join date: 31 Jul 2009
Posts: 20
08-01-2009 15:30
Hey I have a script and I can't figure out what to do or what this error means. Here is the script and error I put a *HERE* where the error is.

default
{
state_entry()
{
integer channel_dialog;
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}

touch_start(integer total_number)
{
ToucherID *HERE*= llDetectedKey(0);
}
}

(10, 14) : ERROR : Name not defined within scope

Could someone fix it and explain to me what the problem was? Thanks.

PS This script is not finished I just saved and noticed a problem. I was working on a Dialogue Menu.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-01-2009 15:40
From: Whitellama Rugani
Hey I have a script and I can't figure out what to do or what this error means. Here is the script and error I put a *HERE* where the error is.

default
{
state_entry()
{
integer channel_dialog;
channel_dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) );
}

touch_start(integer total_number)
{
ToucherID *HERE*= llDetectedKey(0);
}
}

(10, 14) : ERROR : Name not defined within scope

Could someone fix it and explain to me what the problem was? Thanks.

PS This script is not finished I just saved and noticed a problem. I was working on a Dialogue Menu.

You never defined ToucherID before using it. All you have to do is write key ToucherID = llDetectedKey(0); instead of what you have there. Of course, ToucherID will then be defined only within the scope of the touch_start event --"scope" means "between the brackets in which the variable was defined" -- so if you intend to use it somewhere else, you'll need to define ToucherID as a global variable. (The scope of a global variable is the entire script.) To do that, put key ToucherID; before your default event.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Whitellama Rugani
Registered User
Join date: 31 Jul 2009
Posts: 20
08-01-2009 17:06
Thank you for explaining.