View Single Post
03/02/14, 09:14 PM   #3
Krik
Join Date: Feb 2014
Posts: 8
Thanks for the tip. I think that will prove quite handy and it gives me additional insight to other parts of the API.

I got to thinking, after posting, the "OnUpdate" runs far to often for good performance. So while it may not be the best I have it set to run my code every 250 milliseconds.
lua Code:
  1. function OnUpdate()
  2.  
  3.     if (GetGameTimeMilliseconds() - KM.vars.prevruntime > 250) then  
  4.         KCT.vars.prevruntime = GetGameTimeMilliseconds()
  5.  
  6.         -- code to run every 250 milliseconds
  7.     end
  8. end

Now to the second question in my post. I did some testing and found the problem. The wiki say
EVENT_PLAYER_COMBAT_STATE (bool inCombat)
its actually should say something like
EVENT_PLAYER_COMBAT_STATE (integer eventCode, bool inCombat)
In fact now that I am looking some of the other events in the wiki are missing that first integer. I would maybe even assume all events would have an event code as the first variable??? For anyone learning the API that's going to cause huge amounts of confusion.
  Reply With Quote