Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Only if the owner touches me..

Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
04-29-2007 15:05
ok.. I just want to have the script reset when the owner touches the object.. I know I'm close.. just keep getting a syntax error on the integer for touch_start..


CODE

key owner;

state off
{
state_entry()
{
owner = llGetOwner();
llWhisper(0, "turning off!");
llSetText("Off",<1,0,0>,1);

}
touch_start(integer total_number, key id) // when i'm touched..
{
if (llGetOwnerKey(id) == owner) // it is the owner touching me
{
llWhisper(0,"My owner has asked me to reset the script.");
llResetScript(); // reset the script
}
else // its not the owner touching me
{
llWhisper(0,"Only the owner can turn this back on");
}
}
}
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
04-29-2007 15:11
Maybe...
CODE

state off
{
state_entry()
{
llWhisper(0, "turning off!");
llSetText("Off",<1,0,0>,1);
}
touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner())
{
llWhisper(0,"My owner has asked me to reset the script.");
llResetScript(); // reset the script
}
else // its not the owner touching me
{
llWhisper(0,"Only the owner can turn this back on");
}
}
}
Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
closer I think, but still getting same error
04-29-2007 15:37
Getting the same syntax error in the integer of the touch_start..
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
04-29-2007 15:41
Oh.. Oops.. :)

The touch_start event handler just takes a integer - there's no 'key' argument to it..

/me edits her post above.
Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
:-)
04-29-2007 15:54
sweet, I think it works..
Gorge Go
Registered User
Join date: 7 Dec 2006
Posts: 5
One more thing you need
04-30-2007 18:15
state default // Not state off.
{
state_entry()
{
llWhisper(0, "turning off!";);
llSetText("Off",<1,0,0>,1);
}
touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner())
{
llWhisper(0,"My owner has asked me to reset the script.";);
llResetScript(); // reset the script
}
else // its not the owner touching me
{
llWhisper(0,"Only the owner can turn this back on";);
}
}
}
Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
04-30-2007 21:03
there is a lot more to the rest of the script.. but if I could figure out that one event, then i could use it in the rest of the script too.. for a touch_start in the default state..