View Single Post
05/12/14, 11:42 AM   #50
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
Originally Posted by Roupine View Post
I've found that zo_callLater(fn,delay) works well for most of the things I used to use OnUpdate for. Especially if you're buffering OnUpdate to only run every so often, just replace it with a zo_callLater loop for the same length of time.

Code:
zo_callLater( MyMod:UpdateHandler, TIME_IN_MILLISECONDS )
Just add a zo_callLater() at the end of the UpdateHandler function to call itself again. It's still constantly looping a function, but it's a lot less often than 30-60 times a second.

TBH, the only reason I use OnUpdate anymore is to quickly run through a recursive set of functions that run too deep for the game to allow without external activation.
Hey, there is also another useful pair of functions: EVENT_MANAGER:RegisterForUpdate and EVENT_MANAGER:UnregisterForUpdate. You can find more info in the following threads: http://www.esoui.com/forums/showthread.php?t=1228, http://www.esoui.com/forums/showthread.php?t=906 and http://www.esoui.com/forums/showthread.php?t=603
  Reply With Quote