LlBreakLink - Second Life Wiki

LlBreakLink

From Second Life Wiki

(Redirected from LSL llBreakLink)
Jump to: navigation, search

Contents

Description

Function: llBreakLink( integer linknum );
142 Function ID
0.0 Delay
10.0 Energy

Delinks the task with the given link number

• integer linknum Link number (0: unlinked, 1: root prim, >1: child prims) or a LINK_* flag


Requires the PERMISSION_CHANGE_LINKS permission, granted by the owner, to run.

Flag Description
LINK_ROOT 1 sends to root prim in a linked set
LINK_SET -1 sends to all prims
LINK_ALL_OTHERS -2 sends to all other prims
Flag Description
LINK_ALL_CHILDREN -3 sends to all children, (everything but the root)
LINK_THIS -4 sends to the prim the script is in

Caveats

  • Do not depend upon the auto-grant status of permissions. Always use the run_time_permissions event.
  • If the script lacks the permission PERMISSION_CHANGE_LINKS, the script will shout an error on DEBUG_CHANNEL and the operation fails (but the script continues to run).
  • If PERMISSION_CHANGE_LINKS is granted by anyone other then the owner then when the function is called an error will be shouted on DEBUG_CHANNEL.
  • Once the PERMISSION_CHANGE_LINKS permission is granted there is no way to revoke it. The script will only loose the permission if it is reset or the object derezzed (deleted, detached, or taken).
  • This function removes sitting avatars from the object, even if not sitting on the unlinked prim.
  • This function silently fails if called from a script inside an attachment.

Examples

 
//-- requests permission to change links, then breaks the link
//-- between the prim its in and the rest of the object, on touch.
default{
  state_entry(){
    llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS );
  }
 
  run_time_permissions( integer vBitPermissions ){
    if (PERMISSION_CHANGE_LINKS & vBitPermissions){
      state sMain;
    }else{
      llResetScript();
    }
  }
}
 
state sMain{
  touch_start( integer vIntTouched ){
    llBreakLink( LINK_THIS );
  }
}
 

See Also

Events

•  run_time_permissions Permission receiving event
•  changed CHANGED_LINK

Functions

•  llGetLinkNumber Returns the link number of the prim the script is in.
•  llGetPermissions Get the permissions granted
•  llGetPermissionsKey Get the agent who granted permissions
•  llRequestPermissions Request permissions
•  llBreakAllLinks Break all links

Articles

•  Script permissions