OsDropAttachmentAt
From OpenSimulator
(Difference between revisions)
m (XEngine to OSSL) |
(Add new exemples) |
||
| Line 5: | Line 5: | ||
|delay=0 | |delay=0 | ||
|description=Requires script to be granted [[PERMISSION_ATTACH]], drops an attachment at position '''pos''' with rotation '''rot''' | |description=Requires script to be granted [[PERMISSION_ATTACH]], drops an attachment at position '''pos''' with rotation '''rot''' | ||
| − | |additional_info=This function was added in 0.7.5-post-fixes | + | |ossl_example=<source lang="lsl"> |
| + | // | ||
| + | // osForceDropAttachmentAt Script Example (XEngine) | ||
| + | // | ||
| + | |||
| + | vector pos; | ||
| + | rotation rot; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | pos = llGetPos(); | ||
| + | rot = llGetRot(); | ||
| + | |||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); | ||
| + | llSay(PUBLIC_CHANNEL, "Touch it again to see osForceDropAttachmentAt drop this object to its original position and rotation."); | ||
| + | llSay(PUBLIC_CHANNEL, "The posistion is " + (string)pos + " and the rotation is " + (string)rot); | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | if (!llGetAttached()) | ||
| + | { | ||
| + | osForceAttachToAvatar(ATTACH_LHAND); | ||
| + | } | ||
| + | |||
| + | else if (llGetAttached()) | ||
| + | { | ||
| + | osForceDropAttachmentAt(pos, rot); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // 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"> | ||
| + | // | ||
| + | // osForceDropAttachmentAt Script Example (XEngine) | ||
| + | // | ||
| + | |||
| + | vector pos; | ||
| + | rotation rot; | ||
| + | |||
| + | default | ||
| + | { | ||
| + | state_entry() | ||
| + | { | ||
| + | pos = llGetPos(); | ||
| + | rot = llGetRot(); | ||
| + | |||
| + | llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); | ||
| + | llSay(PUBLIC_CHANNEL, "Touch it again to see osForceDropAttachmentAt drop this object to its original position and rotation."); | ||
| + | llSay(PUBLIC_CHANNEL, "The posistion is " + (string)pos + " and the rotation is " + (string)rot); | ||
| + | } | ||
| + | |||
| + | touch_start(integer number) | ||
| + | { | ||
| + | if (!llGetAttached()) | ||
| + | { | ||
| + | osForceAttachToAvatar(ATTACH_LHAND); | ||
| + | } | ||
| + | |||
| + | else if (llGetAttached()) | ||
| + | { | ||
| + | osForceDropAttachmentAt(pos, rot); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | // The attach event is called on both attach and detach. | ||
| + | attach(key id) | ||
| + | { | ||
| + | // Test if is a valid 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(); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </source> | ||
| + | |additional_info=This function was added in 0.7.5-post-fixes.<br> | ||
| + | See [http://wiki.secondlife.com/wiki/Template:LSL_Constants_Attachment Attachment Points] for the complete list of LSL Attachment Points Constants. | ||
}} | }} | ||
| + | '''See Also: ''' | ||
| + | * [[osForceAttachToAvatar]] | ||
| + | * [[osForceAttachToAvatarFromInventory]] | ||
| + | * [[osForceAttachToOtherAvatarFromInventory]] | ||
| + | * [[osForceDetachFromAvatar]] | ||
| + | * [[osForceDropAttachment]] | ||
| + | * [[osForceDropAttachmentAt]] | ||
| + | * [[osDropAttachment]] | ||
| + | * [[osDropAttachmentAt]] | ||
Revision as of 11:02, 24 November 2020
osDropAttachmentAt(vector pos, rotation rot)
| |
| Requires script to be granted PERMISSION_ATTACH, drops an attachment at position pos with rotation rot | |
| Threat Level | Moderate |
| Permissions | ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |
| Extra Delay | 0 seconds |
| Example(s) | |
// // osForceDropAttachmentAt Script Example (XEngine) // vector pos; rotation rot; default { state_entry() { pos = llGetPos(); rot = llGetRot(); llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); llSay(PUBLIC_CHANNEL, "Touch it again to see osForceDropAttachmentAt drop this object to its original position and rotation."); llSay(PUBLIC_CHANNEL, "The posistion is " + (string)pos + " and the rotation is " + (string)rot); } touch_start(integer number) { if (!llGetAttached()) { osForceAttachToAvatar(ATTACH_LHAND); } else if (llGetAttached()) { osForceDropAttachmentAt(pos, rot); } } // 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: // // osForceDropAttachmentAt Script Example (XEngine) // vector pos; rotation rot; default { state_entry() { pos = llGetPos(); rot = llGetRot(); llSay(PUBLIC_CHANNEL, "Touch to see osForceAttachToAvatar attach this object to your avatar's left hand."); llSay(PUBLIC_CHANNEL, "Touch it again to see osForceDropAttachmentAt drop this object to its original position and rotation."); llSay(PUBLIC_CHANNEL, "The posistion is " + (string)pos + " and the rotation is " + (string)rot); } touch_start(integer number) { if (!llGetAttached()) { osForceAttachToAvatar(ATTACH_LHAND); } else if (llGetAttached()) { osForceDropAttachmentAt(pos, rot); } } // The attach event is called on both attach and detach. attach(key id) { // Test if is a valid 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.5-post-fixes. See Attachment Points for the complete list of LSL Attachment Points Constants. | |
See Also: