Working with Events
Since the server is down and I can't test things maybe instead of pulling my hair out I can ask a few questions here.
First, in the MyFirstAddon tutorial, the xml file use an "OnUpdate" element to trigger a function Code:
<OnUpdate> Second, been tinkering with the EVENT_PLAYER_COMBAT_STATE. lua Code:
|
OnUpdate handler Lua side:
Lua Code:
To reset it I think you just have to do Lua Code:
|
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:
Now to the second question in my post. I did some testing and found the problem. The wiki say Quote:
Quote:
|
You don't need to call GetGameTimeMilliseconds(). There are two args passed through to your OnUpdate function. The first is the frame that the OnUpdate is running for. The second is the game time in milliseconds. :p
/edit: re. another question... The event handler is what is getting/passing through the event code. This is so the handler knows which event was fired (and you can do a check to make sure it is the event you want, if using the same function for more than one event). But some events provide their own returns - these are what are listed in the docs. |
Quote:
|
When unsure of what gets passed through functions or script handlers, do something like this:
Lua Code:
Or... Lua Code:
The d() function in ESO will dump everything to your chat frame. |
Again another great piece of information, that I will definitely tap at the next round of beta testing.
I use to do mods about 5 or 6 years ago in WoW, haven't touch Lua since. However I do a lot of programing, I have worked with somewhere around 13 programing languages in the 20+ year I have been programming. Some of the work I do is fixing what someone else has screwed up and I have some great techniques for finding information about functions and bugs when working with someone else's code. Of course all my techniques have been developed over years of experience. This beta was 2 and a half days, in which I managed to get a very simple mod completed (no screenshots so I can't upload it yet, one more test run wouldn't hurt either). So I really didn't feel I had the time to look into ways to extract how the functions works. Of course as soon as I see that part of me goes duh, I keep seeing things that remind me of one programming language or another. And that's the other hassles I ran into this weekend. I am use to needing to look up xyz function in abc language (you can't know everything), but with Lua anytime I tried doing a search all that came up was stuff related to WoW. I would guess some of the results would have the answer, but I would need a better working knowledge of the WoW API to parse out the irrelevant parts. Lua is a super easy language but with all the information buried in obscure websites it makes it much more difficult than it really is. Oh did I mention, again, that should be in the wiki. Anyone that knows programing knows that techniques like that are worth their weight in gold and can save huge amounts of time and hassle just having that info readily available. EDIT: after posting that I thought got any other good tips EDIT: A continuation of the previous edit. Maybe there should be a sticky'ed tips a tricks thread. If you can get 4 or 5 good tips in that and it could really prove useful. |
When I have time I will go through the wiki.
re. a place to post and find tips, there is this forum: http://www.esoui.com/forums/forumdisplay.php?f=172 |
All times are GMT -6. The time now is 09:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI