Tries to move the entire object so that the root prim is within 0.1m of position.
integer llSetRegionPos( vector position );
Forced delay: 0.0 seconds. Energy: 0.0.
Only if TRUE is returned does the object move, if FALSE is returned, the object does not change position. (Spec does not quite agree, if object tries to go underground, the spec says it moves to ground level with the provided X and Y.)
Returns a boolean (an integer) , TRUE if the object is successfully placed within 0.1 m of position, FALSE otherwise. See #Specification for details.
The object with the script will move the root prim position to the given location. The position is any position within the region. If the position is below ground, it will be set to the ground level at that X,Y spot. The function has no delay or throttle.
default
{
touch_start(integer num_detected)
{
vector currentPosition = llGetPos();
// check whether the object has successfully been moved
// to the center of the sim at the same height
integer hasMoved = llSetRegionPos(<128.0, 128.0, currentPosition.z>);
if (hasMoved)
{
llOwnerSay("My new position is now:\n"
+ "http://maps.secondlife.com/secondlife/" + llEscapeURL(llGetRegionName())
+ "/128/128/" + (string)llRound(currentPosition.z) + "/");
}
else if ( currentPosition.z < llGround(ZERO_VECTOR) )
{
llOwnerSay("My new position is now:\n"
+ "http://maps.secondlife.com/secondlife/" + llEscapeURL(llGetRegionName())
+ "/128/128/" + (string)llCeil(llGround(ZERO_VECTOR)) + "/");
}
else
llOwnerSay("Move was not possible!");
}
}
This function is intended to replace WarpPos.