Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem with first use of llSetPos script

Illya Sullivan
Wench
Join date: 3 Dec 2005
Posts: 61
03-27-2006 07:45
Greetings,

I'm using a pretty standard script as an elevator.

CODE

moveTo(vector targetPosition)
{
while (llVecDist(llGetPos(), targetPosition) > 0.001) llSetPos(targetPosition);
}

...
vector targ = llGetPos() + <0,0, 620>;
moveTo(targ);
...


Works great, except the first time after the thing is rezzed. First time you use it, it gets up to about 580 meters or so then returns to the starting point. Second and all subsequent times it goes where it's supposed to.

Any idea what I'm doing wrong?

TIA
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
03-27-2006 08:05
I think this should work.

CODE

moveTo(vector targetPosition)
{
while (llGetPos() != targetPosition) llSetPos(targetPosition);
}

_____________________
Prim Composer for 3dsMax
-- complete offline builder for prims and sculpties in 3ds Max
http://liferain.com/downloads/primcomposer/

Hierarchical Prim Archive (HPA)
-- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools.
https://liferain.com/projects/hpa