Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetPos not updating on reset?

Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-01-2008 03:09
I have always had a problem with this and I am curious as to why if I put a llResetScript(); in an event like on_rez() that the myvector = llGetPos(); I have in my state_entry() doesn't always reset unless I manually reset the script. Am I doing something wrong? Is there something I'm missing?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-01-2008 03:35
From: Yingzi Xue
Am I doing something wrong? Is there something I'm missing?

Yes
&
Yes

Post a bit of code where you tried doing this and we will set you on the right path.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
12-01-2008 03:38
From that description I can't answer yes or no. I would like to see the script:)
_____________________
From Studio Dora
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-01-2008 07:56
It's a basic script that moves an object randomly (that code removed) and then puts the object back in its default position when done. I've noticed if the on_rez event triggers the llResetScript doesn't always cause the starting position and rotation to be updated. I've had this same problem with a door script. Is llResetScript unreliable? Is there something with the prim/object that it keeps the old position and gets a glitch?

From: someone

vector current_position;
rotation current_rotation;

default
{
state_entry()
{
current_position = llGetPos();
current_rotation = llGetRot();
llSetTimerEvent(1);
}

timer()
{
// Movement code here
}

touch_start(integer touches)
{
// End movement and reset to start position
llSetTimerEvent(0);
llSetPos(current_position);
llSetRot(current_rotation);
}

on_rez(integer start_params)
{
llResetScript();
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-01-2008 08:39
Wait. You set the position back to that which you recorded the last time the script reset, so the "new" 'current_position' you record will be the same as the last one. Unless you change that somewhere in your movement code, or you moved more than 10m from the recorded position so you can't move back there in one go (try the "WarpPos" solution).
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-01-2008 08:44
Here's the gist of my post since someone (who has since deleted their post) misunderstood.

Consider my object a door script. I move the door object to open it. I move it back to its original location (obviously, the script example isn't a door, that's not the point). I sell the door in a build. New owner rezzes the build and the door still thinks its old location is the previous coordinates where it was, even though the on_rez event reset the script and the state_entry supposedly set the current position and rotation.

Why does the position/rotation data intermittently not get set to the new location? Is there a bug? Do I need to put in a llSleep(x) delay?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
12-01-2008 09:10
You have done nothing wrong:)
It looks like there is a racing problem in reset.
I would try to move the llGetPos and llGetRot like this:
CODE

vector current_position;
rotation current_rotation;

default
{
state_entry()
{
llSetTimerEvent(1);
}

timer()
{
current_position = llGetPos();
current_rotation = llGetRot();
// Movement code here
}

touch_start(integer touches)
{
// End movement and reset to start position
llSetTimerEvent(0);
llSetPos(current_position);
llSetRot(current_rotation);
}

on_rez(integer start_params)
{
llResetScript();
}
}

That way the reset should be long time over when you read pos and rot
_____________________
From Studio Dora
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
12-01-2008 09:20
Thank you. I figured that's what it was.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
12-01-2008 10:06
From: Yingzi Xue
Here's the gist of my post since someone (who has since deleted their post) misunderstood.

Sorry. It was I who deleted my post (a few seconds after submitting it), and deleted BECAUSE I misread the script and realized it.