Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

why am i getting errors and how to fix it

Bizcut Vanbrugh
Registered User
Join date: 23 Jul 2006
Posts: 99
08-15-2007 06:23
ok i couldnt get any help with a post so i did a work anround but i got a different problem now i keep getting premission erros from the new owners of the item how do i change this to work

//code


key owner;
integer status;


initialize()
{

llSay(0, "initializing...";);

llSetTimerEvent(.1); //honestly you could make this shorter, but what would be the point? .5 seems to work nice.
owner = llGetOwner();
status = 0;
}

default
{

state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
if(llGetOwnerKey(owner) == llGetOwner())//checks to see if we have changed owner
{
llStartAnimation("PistolHold";);
initialize();
}
}

on_rez(integer total_number)
{

if(llGetOwner() != owner)
{
initialize();
}
}

timer()
{


if (llGetAgentInfo(owner) & AGENT_MOUSELOOK)
{
llStopAnimation("PistolHold";);
llStartAnimation("PistolFire";);

}

else
{
llStopAnimation("PistolFire";);
llStartAnimation("PistolHold";);

}

}
}

//end code
Simnelia Petrichor
Registered User
Join date: 10 Feb 2006
Posts: 35
08-15-2007 06:31
Because the permissions are requested in the state_entry event, the script needs to be reset by the new owner to ensure this event takes place. You could put llResetScript() in the on_rez event.
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
08-15-2007 10:59
Change of Ownership would normally be handled in the changed Event Handler:

changed(integer change)
{
if (change & CHANGED_OWNER) llResetScript();
}

The state_entry Event Handler only occurs when a state is run, which in your case is only when the script is reset/compiled.
Bizcut Vanbrugh
Registered User
Join date: 23 Jul 2006
Posts: 99
08-15-2007 12:54
thanks i will try that