Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving Prim Script Help

Esch Snoats
Artist, Head Minion
Join date: 2 May 2006
Posts: 261
02-03-2008 22:19
I need to move a prim from it's current position to another position by clicking it. The problem is I have this script I found where it has a timer, so it goes right back where it was. I'm not a programmer so have no idea how to redo this so that you click it to move it the 1st time, then you click it to move it back to its original spot the 2nd time, without the timer moving it. I tried inserting another touch_start thing where the sleep is but that didn't work. Any help is appreciated, thank you!

default
{
touch_start(integer x)
{

llSetPos(llGetPos()+<0,0,5.0);

llSleep(10);

llSetPos(llGetPos()+<0,0,-5.0>;);

llSleep(1);

llResetScript();
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-03-2008 23:39
CODE

vector gPosOffset = <0.0, 0.0, 5.0>;

default{
touch_start( integer vIntTouched ){
llSetPos( llGetPos() + gPosOffset );
gPosOffset *= -1;
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
02-03-2008 23:39
Try this:

CODE


integer atStart; // Used to determine where we are

default
{

state_entry()
{
atStart = TRUE;
}

touch_start(integer x)
{
if(atStart) // if we are at the start position, move forward
{
atStart = FALSE;
llSetPos(llGetPos()+<0,0,5.0);
}
else // Move back
{
atStart = TRUE;
llSetPos(llGetPos()+<0,0,-5.0>);
}
}
}



Didn't have any coffe yet and could not test it inworld, but I guess it should work :)