OsGrantScriptPermissions

From OpenSimulator

Jump to: navigation, search
osGrantScriptPermissions(key allowed_key, string function)
Dynamically allow ossl execution to owner/creator/group by function name.
Threat Level Severe (Pending Peer Review) is unknown threat level
Permissions Use of this function is always disabled by default
Extra Delay 0 seconds
Example(s)
//
// osGrantScriptPermissions Script Example
//
 
list functions = [
    "osNpcCreate", "osNpcGetPos", "osNpcLoadAppearance", "osNpcGetRot", 
    "osNpcMoveTo", "osNpcRemove", "osNpcSaveAppearance", "osNpcSay", 
    "osNpcSetRot", "osNpcSit", "osNpcStand", "osNpcPlayAnimation", 
    "osNpcStopAnimation","osNpcMoveToTarget", "osNpcStopMoveToTarget",
    "osOwnerSaveAppearance", "osAgentSaveAppearance"
];
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osGrantScriptPermissions usage.");
        llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES);
    }
 
    touch_start(integer number)
    {
        llSay(PUBLIC_CHANNEL, "Enable");
        osGrantScriptPermissions(llGetOwner(), functions);  
        state enabled;
    }
}
 
state enabled
{
    state_entry()
    {
        llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES);
        llSay(PUBLIC_CHANNEL, "ossl functions enabled");
    }
 
    touch_start(integer number)
    {
        osRevokeScriptPermissions(llGetOwner(), functions);
        state default;
    }
}

This example will allow the owner of this object to create and manipulate NPCs. To allow other possibilities, change the llGetOwner() to any key for another avatar or group.


Personal tools
General
About This Wiki