Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to reset script

Prano Quan
Registered User
Join date: 15 Aug 2008
Posts: 29
07-17-2009 23:18
Hello fellow second life users,
I have a question, how do I reset script? I understand a programming script runs from top to bottom. In addition, I have tried using the function "llResetScript", hoping it would reset the script.

Let me explain my scenario, my situation allows a ball to go from Point A to point B, in my script, I've used SetPos, GetPos and basic "for loops". The problem I have no is that the object is now in point B. I wish to (teleport/place/put, whatever you wanna call it) back to Point A so that users won't get confused that ball ONLY goes from Point A to Point B, not backwards...

Am I right in using llResetScript in that the ball should've recognized its original position vector and teleport itself when all script has ran? Please advice, thank you!
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
07-18-2009 00:05
If you save the balls position in a vector at the start (point A) you can always go back to that position.
Sassy Romano
Registered User
Join date: 27 Feb 2008
Posts: 619
07-18-2009 00:34
In the first statement, no, you're only resetting the script. The script needs to move the object back to the start, you're just resetting the script state.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-18-2009 01:50
you are correct in that resetting the script will have no effect on the objects position that it's in (other than to repeat the steps as if it were starting anew from where it is now)

as an example, if you get in the car at home and drive to the store, getting out of the car an back in it does not put you back at home =)

what you need isn't really a reset, but some way to send the object home... for which (in your controlled environment) I would either suggest using warpPos (search for on the forums and the portal) or just using llDie, and keep rezzing new copies at the origin that travel to the end and die.

I should probably address another misconception here.. to say that a script runs from top to bottom... not really true. unless you consider each event it's own micro script, and insert those (and their events) in the order they are triggered.

you can make a script like that, by putting everything in the state_entry event, and calling reset at the end, but it kinda misses out on all the stuff you could be doing with it.
_____________________
|
| . "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...
| -
Prano Quan
Registered User
Join date: 15 Aug 2008
Posts: 29
07-25-2009 22:19
Thanks for that folks, I will be practicing the llDie to reset the script, see if this is possible.. will update the post if it does go well.