Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Picture Changer Script Help Needed

Dmitriy Gausman
Registered User
Join date: 16 May 2007
Posts: 132
08-23-2008 17:33
Hi-
I am trying to make a picture changer that:
1: works with both direction prims (Next) and (Prev) and chat commands /1Next, /1Prev
2: will utlimately only respond to people in the group the object is set to

I haven't gotten to the 2nd part yet, but I am stumped on the whole listen thing, primarily because I just am dense when it comes to understanding where things should be placed (among other faults of my programming skills).

I am using an existing script and trying to modify it. The error I have been getting so far is:

(76,15) : ERROR: Name not defined within scope

I would appreciate any direction anyone can give.

Thank you.
Dmitriy


CODE

// TWO-BUTTON TEXTURE VENDOR
// Origional script by Thili Playfair
// Heavily Modified by Karandas Banjo
// Tiny alter by Maxwell Harmison (just so I can put my name in it...lol)
// Please include these names if you modify or
// re-distribute this code ^_^

string objname;
integer total;
integer counter;
integer change;


next()
{
total=llGetInventoryNumber(INVENTORY_TEXTURE);
objname = llGetObjectName();
counter++;
if(counter>=total)
{
counter=0;
}
llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, counter),4);
}
prev()
{
total=llGetInventoryNumber(INVENTORY_TEXTURE);
objname = llGetObjectName();
if (counter > 0)
{
counter--;
}
else
{
counter=total - 1;
}
llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, counter),4);
}

default
{
state_entry()
{
next();
llSetTimerEvent(0);
llListen(1, "", llGetOwner(), "");

}
listen(integer channel, string name, key id, string msg)
{
}
touch_start(integer total_number)

{

if (msg == "/1next")
{
next();
}
else if ( llGetLinkName(llDetectedLinkNumber(0)) == "next" )
{
next();
}
else if ( llGetLinkName(llDetectedLinkNumber(0)) == "prev" )
{
prev();
}
}

timer()
{
next();
}
on_rez(integer start_param)
{
llResetScript();
}
}
CODE
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
08-23-2008 18:39
You seem to have put your listen logic into your touch_start event handler, where msg isn't in scope.
Dmitriy Gausman
Registered User
Join date: 16 May 2007
Posts: 132
08-23-2008 21:41
Thank you. It works now.