busy state & single update gotcha?

Post » Sun Jul 13, 2014 8:34 pm

What happens if you call for a single update inside the "normal state", and that update then calls another to continue the looping process

BUT then before the update event happens the script goes to the "busy state" ?

Do we need to do this in the busy state to prevent the update loop from getting "stuck" in the busy state:

state BusyState
EVENT onUpdate()
RegisterForSingleUpdate(1.0)
endif
endstate
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Sun Jul 13, 2014 9:48 pm

Huh?

So you have something like this in your script

;Normal StateEvent OnUpdate()    ;do stuff    RegisterForSingleUpdate(1.0)endEvent

And then somewhere you may enter the "BusyState" where you don't want anything to happen, except that you want to make sure that updates will continue after leaving the "BusyState"?

That solution you posted would probably work, or maybe even something like this?

Scriptname _test_testscript extends Quest   ;Normal StateEvent OnUpdate()    ;do stuff    RegisterForSingleUpdate(1.0)endEventEvent OnBeginState()    RegisterForSingleUpdate(1.0) ;or simply call OnUpdate()endEventState BusyState    Event OnUpdate()        ;chill out - stop the update loops    endEventendState
User avatar
Rowena
 
Posts: 3471
Joined: Sun Nov 05, 2006 11:40 am

Post » Sun Jul 13, 2014 3:44 pm

Thank you very much mojo22.

I try to avoid update loops but I am forced to use them sometimes. So I looked thru all the rest of my scripts and lucky for me NO OTHER script had this gotcha in it. I do have some with updates but the updates were in the "nul state" between the busy and normal states where everything runs no mater what the script state is.

User avatar
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am


Return to V - Skyrim