Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Keep script from executing when it is placed on ground

Kurshie Muromachi
Primtastic!
Join date: 24 Apr 2005
Posts: 278
07-14-2005 16:03
How do I setup my object so that when I place it on the ground it does not load up the script inside BUT if I wear the object it loads the script inside of it? I have this timer in my state_entry and when it gets placed on the ground it keeps wanting to animate my avatar. I only want it to do that when I am wearing the object.

Thank you! :)
Kurshie Muromachi
Primtastic!
Join date: 24 Apr 2005
Posts: 278
07-14-2005 16:06
I have the following code. It doesn't execute the code when placed on ground which is cool BUT now it doesn't execute the timer event when I wear the object.

CODE
default
{
state_entry()
{
llOwnerSay("Loaded");
}

attach(key id)
{
integer perm = llGetPermissions();

if (id != NULL_KEY)
{
if (! (perm & PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
llSetTimerEvent(0.50);
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
//llStopAnimation(gAnimName);
}
}
}


I dunno. Maybe I am going about this the wrong way. :/
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
07-14-2005 16:12
Don't bother with llGetPermissions when requesting. Just place the executable code in the run_time_permissions event.

Since this event is automatically run when permissions are already granted, you should have no problem.

CODE
default
{
state_entry()
{
llOwnerSay("Loaded");
}

attach(key id)
{
integer perm = llGetPermissions();

if (id != NULL_KEY)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
//llStopAnimation(gAnimName);
}
}
}

run_time_permissions(integer perm)
{
if(perm)
llSetTimerEvent(0.50);

}

timer()
{
// You do have a timer event... right?
}
_____________________
---
Kurshie Muromachi
Primtastic!
Join date: 24 Apr 2005
Posts: 278
07-14-2005 16:12
Nevermind. I guess it just needed to be reattached and all. Phew. Hehe
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
07-14-2005 16:14
Ehhh... now she tells me. :rolleyes:
_____________________
---