WoW:Using OnUpdate correctly: Difference between revisions

m
Move page script moved page Using OnUpdate correctly to WoW:Using OnUpdate correctly without leaving a redirect
(Using locals instead of globals. See http://www.wowwiki.com/2.0_consolidated_changes (Frame Features))
m (Move page script moved page Using OnUpdate correctly to WoW:Using OnUpdate correctly without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This page is a guide on '''using OnUpdate correctly'''.
== How Often Is It Called ==
== How Often Is It Called ==
The game engine will call your OnUpdate function once each frame.  This is (in most cases) extremely excessive.
The game engine will call your OnUpdate function once each frame.  This is (in most cases) extremely excessive.
*'''Ctrl + R'''  to see the FPS on screen.
<!---
added: *'''Ctrl + R'''  to see the FPS on screen.
- Crixi 2008-08-23
--->


== When Is It Called ==
== When Is It Called ==
Line 12: Line 19:
     <Scripts>
     <Scripts>
       <OnLoad>self.TimeSinceLastUpdate = 0 </OnLoad>
       <OnLoad>self.TimeSinceLastUpdate = 0 </OnLoad>
       <OnUpdate> MyAddon_OnUpdate(self, elapsed); </OnUpdate>       
       <OnUpdate function="MyAddon_OnUpdate" />       
     </Scripts>
     </Scripts>
   </Frame>
   </Frame>
Line 48: Line 55:
   end
   end
  end
  end
[[Category:HOWTOs|Use OnUpdate Correctly]]
[[Category:HOWTOs|Use OnUpdate Correctly]]
Anonymous user