Difference between revisions of "LlGetPermissionsKey"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
m (Clarified the return value description to remove ambiguous language.)
Line 3: Line 3:
|func=llGetPermissionsKey|sort=GetPermissionsKey
|func=llGetPermissionsKey|sort=GetPermissionsKey
|return_type=key
|return_type=key
|func_footnote=Returns {{LSL Const|NULL_KEY|key|&quot;00000000-0000-0000-0000-000000000000&quot;|c=Evaluates to false in conditionals just like invalid keys.}} if permissions were never granted or declined.
|func_footnote=Returns {{LSL Const|NULL_KEY|key|&quot;00000000-0000-0000-0000-000000000000&quot;|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=of the avatar that last granted or declined permissions to the script.
|Return_text=of the avatar that last granted or declined permissions to the script.

Revision as of 14:25, 2 February 2015

Summary

Function: key llGetPermissionsKey( );
0.0 Forced Delay
10.0 Energy

Returns the 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).

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();

    // PUBLIC_CHANNEL has the integer value 0
    llSay(PUBLIC_CHANNEL,
        "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(PUBLIC_CHANNEL, "Can't detach from you, you have not granted ATTACH perms.");
        }
        else
            llSay(PUBLIC_CHANNEL, "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

Signature

function key llGetPermissionsKey();