Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

attachment clickable only by the owner?

Frequency Picnic
Registered User
Join date: 31 Oct 2006
Posts: 13
06-13-2008 13:20
I'm using this in an attachment to toggle an animation, but currently it triggers it in anyone who clicks it. What do I do to make it only animate the wearer? I think I used a freebie dance ball script, which was probably a bad idea now that I think of it >.<

Thanks!



string ani;
key anikey;
key toucher;
integer t;

default
{
state_entry()
{
ani = llGetInventoryName(INVENTORY_ANIMATION, 0);
anikey = llGetInventoryKey(ani);
}

touch_start(integer total_number){



toucher = llDetectedKey(0);
llRequestPermissions(llDetectedKey(0),PERMISSION_TRIGGER_ANIMATION);

if (t == 0)
{
t = 1;
llSay(1,"on";);


} else
{
t = 0;
llSay(1,"off";);

}


}
run_time_permissions(integer perm){
if (perm & PERMISSION_TRIGGER_ANIMATION){
list anims = llGetAnimationList(toucher);
if ( llListFindList(anims, [anikey] ) != -1 ){
llStopAnimation(ani);
}
else{
llStartAnimation(ani);
}
}
}
changed(integer change){
if (change & CHANGED_INVENTORY){
llResetScript();
}
}
}
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-13-2008 14:30
CODE

string ani;
key anikey;
key toucher;
integer t;

default
{
state_entry()
{
ani = llGetInventoryName(INVENTORY_ANIMATION, 0);
anikey = llGetInventoryKey(ani);
}

touch_start(integer total_number){
toucher = llDetectedKey(0);
if ( toucher == llGetOwner())
{
llRequestPermissions(llDetectedKey(0),PERMISSION_TRIGGER_ANIMATION);
if (t == 0)
{
t = 1;
llSay(1,"on");
} else
{
t = 0;
llSay(1,"off");

}
}
}
run_time_permissions(integer perm){
if (perm & PERMISSION_TRIGGER_ANIMATION){
list anims = llGetAnimationList(toucher);
if ( llListFindList(anims, [anikey] ) != -1 ){
llStopAnimation(ani);
}
else{
llStartAnimation(ani);
}
}
}
changed(integer change){
if (change & CHANGED_INVENTORY){
llResetScript();
}
}
}

I added a test for Owner in you script so only Owner touches are active
_____________________
From Studio Dora
Frequency Picnic
Registered User
Join date: 31 Oct 2006
Posts: 13
06-15-2008 13:10
Lovely! Thank you so much for your help, Dora!