Difference between revisions of "LlGetPermissionsKey"

From Second Life Wiki
Jump to navigation Jump to search
m (not sure about this yet... will see.)
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function
{{Issues/SVC-4862}}{{LSL_Function
|func_id=137|func_sleep=0.0|func_energy=10.0
|func_id=137|func_sleep=0.0|func_energy=10.0
|func=llGetPermissionsKey|sort=GetPermissionsKey
|func=llGetPermissionsKey|sort=GetPermissionsKey
|return_type=key
|return_type=key|return_subtype=avatar
|func_footnote={{LSLG|NULL_KEY}} if not enabled.
|func_footnote=Returns {{LSL Const|NULL_KEY|key|"00000000-0000-0000-0000-000000000000"|c=Evaluates to false in conditionals just like invalid keys.}} if permissions were neither granted nor declined (e.g., the permissions dialog was cancelled or otherwise ignored).
|func_desc=
|func_desc
|return_text=that is the agent that permissions are enabled for.
|Return_text=of the avatar that last granted or declined permissions to the script.
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples
|examples=
<source lang="lsl2">
// 1. rez a cube
// 2. create a new script and paste this
// 3. save script
// 4. right-click the prim and choose attach
// 5. touch the prim
 
announce_permissions_key()
{
    key permissionsKey = llGetPermissionsKey();
 
    llSay(0, "key llGetPermissionsKey() = '" + (string)permissionsKey + "'");
}
 
default
{
    state_entry()
    {
        announce_permissions_key();
 
        key owner = llGetOwner();
        llRequestPermissions(owner, PERMISSION_ATTACH);
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        key owner = llGetOwner();
        key permissionsKey = llGetPermissionsKey();
 
        if (id == owner)
        {
            if (permissionsKey == owner)
                llDetachFromAvatar();
            else
                llSay(0, "Can't detach from you, you have not granted ATTACH perms.");
        }
        else
            llSay(0, "Sorry, you're not the owner!");
    }
 
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_ATTACH)
            announce_permissions_key();
    }
}
</source>
|helpers
|helpers
|also_functions=*{{LSLG|llGetPermissions}}
|also_functions={{LSL DefineRow||[[llGetPermissions]]|}}
{{LSL DefineRow||[[llRequestPermissions]]|}}
|also_tests
|also_tests
|also_events=*{{LSLG|run_time_permissions}}
|also_events={{LSL DefineRow||[[run_time_permissions]]|}}
|also_articles
|also_articles
|notes
|notes
|permission
|inventory
|negative_index
|cat1=Permissions/Script
|cat1=Permissions/Script
|cat2
|cat2

Latest revision as of 14:54, 23 September 2015

Summary

Function: key llGetPermissionsKey( );

Returns the avatar (a key) of the avatar that last granted or declined permissions to the script.

Returns NULL_KEY if permissions were neither granted nor declined (e.g., the permissions dialog was cancelled or otherwise ignored).

Caveats

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llGetPermissionsKey() doesn't return NULL_KEY when permissions are declined

Examples

// 1. rez a cube
// 2. create a new script and paste this
// 3. save script
// 4. right-click the prim and choose attach
// 5. touch the prim

announce_permissions_key()
{
    key permissionsKey = llGetPermissionsKey();

    llSay(0, "key llGetPermissionsKey() = '" + (string)permissionsKey + "'");
}

default
{
    state_entry()
    {
        announce_permissions_key();

        key owner = llGetOwner();
        llRequestPermissions(owner, PERMISSION_ATTACH);
    }

    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        key owner = llGetOwner();
        key permissionsKey = llGetPermissionsKey();

        if (id == owner)
        {
            if (permissionsKey == owner)
                llDetachFromAvatar();
            else
                llSay(0, "Can't detach from you, you have not granted ATTACH perms.");
        }
        else
            llSay(0, "Sorry, you're not the owner!");
    }

    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_ATTACH)
            announce_permissions_key();
    }
}

See Also

Events

•  run_time_permissions

Functions

•  llGetPermissions
•  llRequestPermissions

Deep Notes

All Issues

~ Search JIRA for related Issues
   llGetPermissionsKey() doesn't return NULL_KEY when permissions are declined

Signature

function key llGetPermissionsKey();