
I'm doing a script that just moves a prim from a "stored" position to a "use" position with a click, and click again to move it back to the stored position. Positioning it works fine. The prim also needs to be rotated a bit, which is where the problem is.
Rotating it to the "use" position doesn't do well. It's not applying the right rotation values. I can enter the values in edit object screen, and the prim rotate fine. The second click rotates and postions the prim back to "stored" fine. It's just the "use" rotation that has issues.
Help.. would be greatly appreciated

// script
integer on = TRUE;
vector use = <-5.2565, 0.1382, -1.90>; // use difference from stored position.
rotation userot = <0.0, 90.0, 122.0, 0>; // use rotation values.
vector stored; // gets location of stored prim
rotation storedrot = <0.0, 0.0 , 180, 0>; // stored rotation values.
default
{
state_entry()
{
stored = llGetPos(); // gets the current postion of the prim
}
touch_start(integer x)
{
if (on==TRUE)
{
llSetPos(stored - use); // calculate new position and move to use position
llSetLocalRot (userot); // rotate prim for use. ** <-THIS DOES NOT WORK
on = FALSE;
}
else if (on==FALSE)
{
llSetPos(stored); // move prim back to stored position
llSetLocalRot(storedrot); // rotate it to storedrot. ** <-THIS WORKS
on=TRUE;
}
}
}
// end