OsForceAttachToAvatar: Difference between revisions
From OpenSimulator
Jump to navigationJump to search
imported>Manni No edit summary |
imported>Djphil Remove wrong script |
||
| Line 9: | Line 9: | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
// | // | ||
// osForceAttachToAvatar Script Example | // osForceAttachToAvatar Script Example (XEngine) | ||
// | // | ||
default | default | ||
{ | { | ||
state_entry() | state_entry() | ||
{ | { | ||
llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); | |||
} | |||
touch_start(integer number) | |||
{ | |||
if (!llGetAttached()) | |||
{ | |||
osForceAttachToAvatar(ATTACH_LHAND); | |||
} | |||
} | |||
// The attach event is called on both attach and detach. | |||
attach(key id) | |||
{ | |||
// Test if is a valid key and not NULL_KEY ('id' is only valid on attach) | |||
if (id && id != NULL_KEY) | |||
{ | |||
llOwnerSay("The object is attached to " + llKey2Name(id)); | |||
} | |||
else | |||
{ | |||
llOwnerSay("The object is not attached!"); | |||
} | |||
} | } | ||
on_rez(integer param) | |||
{ | |||
// Reset the script if it's not attached. | |||
if (!llGetAttached()) | |||
{ | |||
llResetScript(); | |||
} | |||
} | |||
} | |||
</source> | |||
''' For YEngine: ''' | |||
<source lang="lsl"> | |||
// | |||
// osForceAttachToAvatar Script Example (YEngine) | |||
// | |||
default | |||
{ | |||
state_entry() | |||
{ | { | ||
llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); | |||
} | } | ||
touch_start(integer number) | |||
{ | { | ||
if (!llGetAttached() ) | if (!llGetAttached()) | ||
{ | |||
osForceAttachToAvatar(ATTACH_LHAND); | |||
} | |||
} | } | ||
// The attach event is called on both attach and detach. | |||
attach(key id) | attach(key id) | ||
{ | { | ||
// | // Test if is a valid key and not NULL_KEY ('id' is only valid on attach) | ||
if (id) | if (id) | ||
llOwnerSay( "The object is attached to " + llKey2Name(id) ); | { | ||
llOwnerSay("The object is attached to " + llKey2Name(id)); | |||
} | |||
else | else | ||
llOwnerSay( "The object is not attached"); | { | ||
llOwnerSay("The object is not attached!"); | |||
} | |||
} | |||
on_rez(integer param) | |||
{ | |||
// Reset the script if it's not attached. | |||
if (!llGetAttached()) | |||
{ | |||
llResetScript(); | |||
} | |||
} | } | ||
} | } | ||
</source> | </source> | ||
|additional_info=This function was added in 0.7.4-post-fixes | |additional_info=This function was added in 0.7.4-post-fixes.<br> | ||
See [http://wiki.secondlife.com/wiki/Template:LSL_Constants_Attachment Attachment Points] for the complete list of attachment points. | |||
}} | }} | ||
'''See Also: ''' | |||
* [[osForceAttachToAvatar]] | |||
* [[osForceAttachToAvatarFromInventory]] | |||
* [[osForceAttachToOtherAvatarFromInventory]] | |||
* [[osForceDetachFromAvatar]] | |||
* [[osForceDropAttachment]] | |||
* [[osForceDropAttachmentAt]] | |||
* [[osDropAttachment]] | |||
* [[osDropAttachmentAt]] | |||
Revision as of 12:14, 24 November 2020
osForceAttachToAvatar(integer attachmentPoint)
| |
| Works exactly like llAttachToAvatar() except that PERMISSION_ATTACH is not required. | |
| Threat Level | High |
| Permissions | ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |
| Extra Delay | 0 seconds |
| Example(s) | |
//
// osForceAttachToAvatar Script Example (XEngine)
//
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand.");
}
touch_start(integer number)
{
if (!llGetAttached())
{
osForceAttachToAvatar(ATTACH_LHAND);
}
}
// The attach event is called on both attach and detach.
attach(key id)
{
// Test if is a valid key and not NULL_KEY ('id' is only valid on attach)
if (id && id != NULL_KEY)
{
llOwnerSay("The object is attached to " + llKey2Name(id));
}
else
{
llOwnerSay("The object is not attached!");
}
}
on_rez(integer param)
{
// Reset the script if it's not attached.
if (!llGetAttached())
{
llResetScript();
}
}
}
For YEngine: //
// osForceAttachToAvatar Script Example (YEngine)
//
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand.");
}
touch_start(integer number)
{
if (!llGetAttached())
{
osForceAttachToAvatar(ATTACH_LHAND);
}
}
// The attach event is called on both attach and detach.
attach(key id)
{
// Test if is a valid key and not NULL_KEY ('id' is only valid on attach)
if (id)
{
llOwnerSay("The object is attached to " + llKey2Name(id));
}
else
{
llOwnerSay("The object is not attached!");
}
}
on_rez(integer param)
{
// Reset the script if it's not attached.
if (!llGetAttached())
{
llResetScript();
}
}
}
| |
| Notes | |
| This function was added in 0.7.4-post-fixes. See Attachment Points for the complete list of attachment points. | |
See Also: