DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
09-24-2005 21:27
I'm not sure if this is a bug or not, but I was asked about the proper functionality of a script that is reset within a non-default state.
I was under the impression that the script would reset back to the state it was in when reset (not the default state). I'm probably wrong about that, but to check, I ran a test with a simple cube and a "New Script." Within the touch_start, I added a call to state two. Then, within the state_entry() of state two, I only called a test chat and llResetScript();. When I run the script and click the prim, I am switched to state two, and the script resets. However, it resets back to the default state and runs the default state_entry(). The issue is that it doesn't seem to recognize the touch_start() event within the default state.
To get the default touch_start() to function again, I have to add a blank touch_start() within state two.
I'll probably report this as a bug, but want to make sure I'm not doing something wrong, and I'd like to correct the bad advice I might have given someone.
So, when a script is reset from a non-default state.. should it reset to the non-default state, or should it revert back to default? Either way, it seems confused to me.
|
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
|
09-24-2005 22:06
From: DoteDote Edison I was under the impression that the script would reset back to the state it was in when reset (not the default state).
This is not the case, no. llResetScript() resets the script completely (just as if you recompiled it or reset it manually), so naturally it ends up in the default state (the script memory is completely reset so it would have no memory of where it was before). From: someone The issue is that it doesn't seem to recognize the touch_start() event within the default state.
Yes, this a bug, but it appears to be a bug in the viewer and not necessarilly in LSL. You should definitely report it though.
|
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
|
09-24-2005 23:10
From: Ushuaia Tokugawa This is not the case, no. llResetScript() resets the script completely (just as if you recompiled it or reset it manually), so naturally it ends up in the default state (the script memory is completely reset so it would have no memory of where it was before). Thanks, this should be made more clear under the llResetScript() page of the script wiki. Currently, there is a line that states: The active state becomes default and state_entry is triggered. The wiki should state: The default state becomes the active state, and state_entry is triggered.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
09-25-2005 12:23
Corrections made (thou you could have made them)
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|