Difference between revisions of "User:Toy Wylie/RLV Documentation/detach"
Jump to navigation
Jump to search
(first draft) |
m (Fixed code formating) |
||
Line 15: | Line 15: | ||
|seealso=attach detachme detachthis detachallthis | |seealso=attach detachme detachthis detachallthis | ||
|seealsoalso=Shared Objects Tutorial | |seealsoalso=Shared Objects Tutorial | ||
|example=< | |example=<source lang="lsl2"> | ||
lock() | |||
{ | { | ||
llOwnerSay("@detach=n"); | llOwnerSay( "@detach=n" ); | ||
llOwnerSay("This attachment is now locked on. It will unlock automatically in 30 seconds."); | llOwnerSay( "This attachment is now locked on. It will unlock automatically in 30 seconds." ); | ||
llSetTimerEvent(30.0); | |||
llSetTimerEvent( 30.0 ); | |||
} | } | ||
default | default | ||
{ | { | ||
on_rez(integer num) | on_rez( integer num ) | ||
{ | { | ||
llResetScript(); | llResetScript(); | ||
} | } | ||
state_entry() | state_entry() | ||
{ | { | ||
if(llGetAttached()==0) | if( llGetAttached() == 0 ) | ||
{ | { | ||
llOwnerSay("@acceptpermission=add"); | llOwnerSay( "@acceptpermission=add" ); | ||
llOwnerSay("Please attach me to your avatar."); | llOwnerSay( "Please attach me to your avatar." ); | ||
llRequestPermissions(llGetOwner(),PERMISSION_ATTACH); | llRequestPermissions( llGetOwner(), PERMISSION_ATTACH ); | ||
return; | return; | ||
} | } | ||
lock(); | lock(); | ||
} | } | ||
attach(key k) | |||
attach( key k ) | |||
{ | { | ||
if(k!=NULL_KEY) | if( k != NULL_KEY ) | ||
lock(); | lock(); | ||
} | } | ||
touch_start(integer num) | |||
touch_start( integer num ) | |||
{ | { | ||
if(llDetectedKey(0)==llGetOwner()) | if( llDetectedKey( 0 ) == llGetOwner() ) | ||
{ | { | ||
llOwnerSay("@detach=force"); | llOwnerSay( "@detach=force" ); | ||
llOwnerSay("Now all of your unlocked attachments have been detached."); | llOwnerSay( "Now all of your unlocked attachments have been detached." ); | ||
} | } | ||
} | } | ||
timer() | timer() | ||
{ | { | ||
llSetTimerEvent(0.0); | llSetTimerEvent( 0.0 ); | ||
llOwnerSay("@detach=y"); | llOwnerSay(" @detach=y" ); | ||
llOwnerSay("This attachment is now unlocked."); | llOwnerSay(" This attachment is now unlocked." ); | ||
} | } | ||
run_time_permissions(integer perms) | |||
run_time_permissions( integer perms ) | |||
{ | { | ||
if(perms & PERMISSION_ATTACH) | if( perms & PERMISSION_ATTACH ) | ||
{ | { | ||
llAttachToAvatar(ATTACH_RHAND); | llAttachToAvatar( ATTACH_RHAND ); | ||
} | } | ||
} | } | ||
} | } | ||
</ | </source> | ||
|example_2=< | |example_2=<source lang="lsl2"> | ||
string folder = "Outfits/Casual/Streetwear"; | |||
default | default | ||
{ | { | ||
on_rez(integer num) | on_rez( integer num ) | ||
{ | { | ||
llResetScript(); | llResetScript(); | ||
} | } | ||
state_entry() | state_entry() | ||
{ | { | ||
llOwnerSay("Touch me to detach the contents of the folder #RLV/"+folder); | llOwnerSay( "Touch me to detach the contents of the folder #RLV/" + folder ); | ||
} | } | ||
touch_start(integer num) | |||
touch_start( integer num ) | |||
{ | { | ||
if(llDetectedKey(0)==llGetOwner()) | if( llDetectedKey( 0 ) == llGetOwner() ) | ||
{ | { | ||
llOwnerSay("@detach:"+folder+"=force"); | llOwnerSay( "@detach:" + folder + "=force" ); | ||
llOwnerSay("Folder contents have been detached."); | llOwnerSay( "Folder contents have been detached." ); | ||
} | } | ||
} | } | ||
} | } | ||
</ | </source> | ||
}} | }} |
Latest revision as of 16:40, 3 August 2019
@detach
Type
# Restriction
- General
- General
Implemented
Implemented since RLV version
- 1.0a
- 1.20
- 1.11
Usage
# @detach[:<attachmentpoint>]=<y/n>
- @detach[:<attachmentpoint>]=force
- @detach:<folder/path>=force
Purpose
# Locks an attachment point. The user won't be able to attach or detach anything to or from this attachment point. Leaving out the attachment point will result in a block of the attachment point of the object issuing the command only.
- Force detaches the attachment at the specified attachment point. If no attachment point is given, it will detach all attachments currently worn (which are not locked).
- Force detaches and unwears all items of the specified folder. If the folder has the same name as an attachment point, only that attachment point will be detached, so make sure not to name your folders after attachment points.
See Also
Example 1
lock()
{
llOwnerSay( "@detach=n" );
llOwnerSay( "This attachment is now locked on. It will unlock automatically in 30 seconds." );
llSetTimerEvent( 30.0 );
}
default
{
on_rez( integer num )
{
llResetScript();
}
state_entry()
{
if( llGetAttached() == 0 )
{
llOwnerSay( "@acceptpermission=add" );
llOwnerSay( "Please attach me to your avatar." );
llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
return;
}
lock();
}
attach( key k )
{
if( k != NULL_KEY )
lock();
}
touch_start( integer num )
{
if( llDetectedKey( 0 ) == llGetOwner() )
{
llOwnerSay( "@detach=force" );
llOwnerSay( "Now all of your unlocked attachments have been detached." );
}
}
timer()
{
llSetTimerEvent( 0.0 );
llOwnerSay(" @detach=y" );
llOwnerSay(" This attachment is now unlocked." );
}
run_time_permissions( integer perms )
{
if( perms & PERMISSION_ATTACH )
{
llAttachToAvatar( ATTACH_RHAND );
}
}
}
Example 2
string folder = "Outfits/Casual/Streetwear";
default
{
on_rez( integer num )
{
llResetScript();
}
state_entry()
{
llOwnerSay( "Touch me to detach the contents of the folder #RLV/" + folder );
}
touch_start( integer num )
{
if( llDetectedKey( 0 ) == llGetOwner() )
{
llOwnerSay( "@detach:" + folder + "=force" );
llOwnerSay( "Folder contents have been detached." );
}
}
}