Difference between revisions of "RegionSitTeleport"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (some minor readability improvements) |
m (→RegionSitTeleport: Replace <source> with <syntaxhighlight>) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description. | It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description. | ||
< | <syntaxhighlight lang="lsl2"> | ||
//////////////////////////////////////////////////////// | //////////////////////////////////////////////////////// | ||
// Written by Vincent Nacon | // Written by Vincent Nacon | ||
// Released into the Public Domain | // Released into the Public Domain | ||
// I'm sick and tired of WarpPos and <0,0,0> bug. | // I'm sick and tired of WarpPos and <0,0,0> bug. | ||
// | // Feb 26th 2012 | ||
//////////////////////////////////////////////////////// | //////////////////////////////////////////////////////// | ||
Line 30: | Line 30: | ||
llSetRegionPos(targetPosition); | llSetRegionPos(targetPosition); | ||
llUnSit( | llUnSit(sittingAvatar); | ||
llSetRegionPos(positionToReturnTo); | llSetRegionPos(positionToReturnTo); | ||
} | } | ||
Line 37: | Line 37: | ||
state_entry() | state_entry() | ||
{ | { | ||
llSitTarget(<0.0, 0.0, 0.1>, | llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); | ||
} | } | ||
} | } | ||
</ | </syntaxhighlight> | ||
{{LSLC|Library|RegionSitTeleport}} | {{LSLC|Library|RegionSitTeleport}} |
Latest revision as of 16:40, 26 September 2022
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
- Created by User:Vincent_Nacon
RegionSitTeleport
It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description.
////////////////////////////////////////////////////////
// Written by Vincent Nacon
// Released into the Public Domain
// I'm sick and tired of WarpPos and <0,0,0> bug.
// Feb 26th 2012
////////////////////////////////////////////////////////
//What to do?
//Just place position (in vector form) where you want to drop avatar at in the prim's description.
default
{
changed(integer change)
{
vector targetPosition = (vector)llGetObjectDesc();
key sittingAvatar = llAvatarOnSitTarget();
if(sittingAvatar)
{
vector positionToReturnTo = llGetPos();
llSetRegionPos(targetPosition);
llUnSit(sittingAvatar);
llSetRegionPos(positionToReturnTo);
}
}
state_entry()
{
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
}
}