Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving a prim, simplified please

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
03-15-2007 19:43
Hi,

I need to move a prim (cylinder) to a fixed location in my sim. I have tried llsetpos, llMoveToTarget, llsetprimitiveparams, all without success (setpos and setprimparams only move the prim a max of 10 m, and I need anywhere in the sim, up to a max of 768m, but more commonly just above ground level). Can anyone suggest a simple script (for a simple noob) to achieve this?

Thanks

Rock
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
03-15-2007 20:08
CODE

vector vend = <x,y,z>;
vector vcur;

default
{
state_entry()
{
while(vcur != vend)
{
llSetPos(vend);
vcur = llGetPos();
}
}
}
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
03-16-2007 00:53
WarpPos was broken by the recent server update, but it should be back soon. (At least, that's what I assume you meant by llSetPrimitiveParams)

Also, that code would be better written
CODE

vector dest = <x,y,z>;

default
{
state_entry()
{
while( llVecDist( dest, llGetPos() ) > .01 )
llSetPos(dest);
}
}


The llVecDist is there to avoid a bug where the object will never be able to precisely reach a destination.

Alternatively,
CODE

vector dest = <x,y,z>;

default
{
state_entry()
{
integer jumps = (integer)( llVecDist( dest, llGetPos() ) / 10.0 ) + 1;
while( n-- )
llSetPos(dest);
}
}


But really, WarpPos would be a better option, as soon as the Lindens do the next grid update. There's a link in my signature to the code, which you can drop into a script.
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
03-16-2007 02:26
[QUOTE
But really, WarpPos would be a better option, as soon as the Lindens do the next grid update. There's a link in my signature to the code, which you can drop into a script.[/QUOTE]

Many thanks for the code, it works fine. My next step on this scripting adventure is to get the cylinder to move when touched, and finally to have it move when a button on a menu is touched,as eventually there will be 12 cylinders to move.

Pity about the warppos, it was scuppered by the latest bug 'fixes', as so many features are nowadays. So now offering tps via search results/profiles no longer work, water doesn't show on tp unless you go into World, Region/Estate and out again, and now most teleporter systems in sl don't work, all after 'upgrades'!! Why are these probs not picked up on the beta grid before being rolled out on the main grid? I despair sometimes.

Rock