|
Shifting Dreamscape
Always questioning ...
Join date: 12 Dec 2007
Posts: 266
|
05-20-2008 16:35
Hi All ...
I have been re-writing a series of scripts, using states to reduce the numbe of global flags and if statements and found something that in hindsight makes sense (I think). A Listen set up in one state does not continue to the next state. Since states are all about 'new' event handlers ... I think this makes sense.
Questions is (or are):
Does this apply to timers as well? Does that mean that when I leave a state where a listen (or a timer) was set, that I don't have to turn it off? If I return to the state where the listen or timer was set .. do I need to reset it or is it still there?
Thanks in Advance!
|
|
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
|
05-20-2008 16:53
as you might have read states are basicly "multi scripts" as in they act just like 2+ sctripts put togeather, everything will be new EXCEPT linked messages and strings, and they will contune the same way timer wise if you didnt add any new event timers
Dont qute me on all of it but that is all i can rember off the top of my head atm
|
|
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
|
05-20-2008 17:07
I ran into a situation that confused me as to what was really occuring, and never really set up test cases to find out.
I *believe* that leaving a state does disable the llSetTimerEvent(), and re-entering the state does not automatically re-enable/resume the timer.
I ran into a strange issue that made me uncertain about the behavior of timers and states:
A two state door: CLOSED (touch & no timer), and OPEN (touch & timer)
Touching the door caused it to change states (and positions). If left open the timer would force it to change back to the closed state after a minute.
The weird behavior was this: Letting the door auto-close and then opening it caused it to flick open.. and then it immediately slammed shut.
I thought the expired timer was causing it to jump into timer()... but it seemed to be more of an issue with touch the touch event getting triggered twice. (I'm not able to log in at the moment, the script may be old enough that it uses touch() instead of touch_start() which might be the problem).
Anyway, just because I'm paranoid, I always disable or re-enable llSetTimerEvent() as the first thing in state_entry(), just to be explicit.
|
|
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
|
05-20-2008 17:58
See http://wiki.secondlife.com/wiki/StateThe timer event clock is NOT cleared on a state change.
|
|
Shifting Dreamscape
Always questioning ...
Join date: 12 Dec 2007
Posts: 266
|
05-21-2008 04:47
Thanks all .. should have looked in the wiki
|