ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   News (https://www.esoui.com/forums/forumdisplay.php?f=5)
-   -   AddOn API Released! (https://www.esoui.com/forums/showthread.php?t=80)

Cairenn 02/20/14 06:20 PM

AddOn API Released!
 
We're happy to announce that we've gotten permission to release the AddOn API for ESO. You can find it on our wiki. In addition to the list of API Functions and Events, we've also posted Zenimax's AddOn Quick Questions and their 'My First Addon' tutorial.

At present the API Functions and Events are merely listed alphabetically. Getting them sorted into their various categories (ie Global Variables, Object API, etc.) and having things like what parameters get returned haven't been added yet. That's the joy of a Wiki, though, everyone is welcome to contribute as they can.

Have at it guys & gals!

zork 02/21/14 02:57 AM

That OnUpdate tag in the XML that everyone seems to be using right now. How often is that firing? Every frame? According to the this snippet (..."We're just going to make a simple window frame with some text on it that updates every frame."...) I would guess yes.

Code:

  <OnUpdate>
    DoStuff()
  </OnUpdate>

Are there any arguments that allow throttling like elapsed?

Article from the wow wiki page regarding that kind of trigger:
http://www.wowwiki.com/Using_OnUpdate_correctly
http://wowpedia.org/Using_OnUpdate_correctly

Frame rate and the human eye
http://en.wikipedia.org/wiki/Frame_rate

JonathanDark 02/21/14 09:21 AM

Quote:

Originally Posted by Cairenn (Post 419)
We're happy to announce that we've gotten permission to release the AddOn API for ESO.

And there was much rejoicing!

Wykkyd 02/21/14 12:05 PM

Quote:

Originally Posted by zork (Post 427)
Are there any arguments that allow throttling like elapsed?

Cross posting this from something I posted somewhere else I can't talk about ;)

Quote:

Events in this game can trigger really, really... really fast. If you want to know how fast you can easily dump a counter to your chat window when that event triggers and watch as it fliiieeeeesssss by. This can cause issues when your update script has to parse something or do any heavy lifting. In fact, it can cause a problem at times when your update script isn't really doing much.

The safe way to handle this is to buffer your event handling so that you're only processing updates at set intervals, instead of nearly instantaneously. And yes, some things are fine at lightening speed but I've found that most work just fine between 0.33 and 3 seconds.

In the case of my War Tools addon (found within my [MH] Addon Suite) I parse Cyrodiil rather extensively. When I first drafted the addon I walked into Cyrodiil, the events registered and I instantly entered stutter-frame, stop-motion TESO. It... was... bad...

The simple fact was that events were triggering too quickly for the Cyrodiil parser to constantly run the way it was. In fact, it was running in layers on top of itself because the events fired so fast.

I also use this trick in Gear Tools (also in the Addon Suite) to build a queuing system to handle gear moves because items can't all be unequipped all at once. You have to trigger those moves one at a time. So, I pile the "these things need to happen" gear moves into a table and I execute anything pending in the table, 1 item per iteration, as the OnUpdate event triggers in the addon... at a 0.33 buffer. Because anything faster than 1/3rd of a second doesn't allow time for gear to move properly and register with your UI.

This is the basic buffer I use, modified for "generic and global" application:
Code:

local BufferTable = {}
function BufferReached(key, buffer)
        if key == nil then return end
        if BufferTable[key] == nil then BufferTable[key] = {} end
        BufferTable[key].buffer = buffer or 3
        BufferTable[key].now = GetFrameTimeSeconds()
        if BufferTable[key].last == nil then BufferTable[key].last = BufferTable[key].now end
        BufferTable[key].diff = BufferTable[key].now - BufferTable[key].last
        BufferTable[key].eval = BufferTable[key].diff >= BufferTable[key].buffer
        if BufferTable[key].eval then BufferTable[key].last = BufferTable[key].now end
        return BufferTable[key].eval
end

This is how you would consume that buffer in an event/update handler:
Code:

function OnUpdateHandler()
        if not BufferReached("myaddonupdatebuffer", 1) then return; end
        --[[ process your update here ]]--
end

Hopefully this little tidbit helps someone. ;)
Cairenn it might be good to have tips like this in your wiki, since OnUpdate fires so quickly it's likely to crash a LOT of people if addons are written that don't know how to buffer properly.

Seerah 02/21/14 12:34 PM

It's a wiki - anyone can help out! :)

Cairenn 02/21/14 01:38 PM

What Seerah said. Feel free to add it, and any other tips you have. :)

Holylifton 02/21/14 03:29 PM

Quote:

Originally Posted by JonathanDark (Post 437)
And there was much rejoicing!

Read your creds from a previous post. Looking forward to see what you come up with.

Xrystal 02/21/14 03:59 PM

Cheer :banana::banana:

Now I can start looking to see what I can do. My guildies in wow are already looking forward to what addons I think up for ESO.

Of course, no beta this weekend *sigh*

Kelnoreem 02/21/14 03:59 PM

Quote:

Originally Posted by Wykkyd (Post 441)
Cross posting this from something I posted somewhere else I can't talk about ;).

This info was timely for me, as I don't have access to that somewhere else, but have started looking at ESO LUA addon development.

Xrystal 02/21/14 05:15 PM

Hmm, am I reading it right.

The Addon Tutorial gives the impression you can start a new addon while still inside ESO playing. Unlike WOW where you have to be logged out to set the files up. Or, is it assuming we know that already.

Seerah 02/21/14 08:00 PM

Nope. You can add files and even whole addons while the game is running. You just need to reload the UI for it to pick them up.

Wykkyd 02/21/14 08:39 PM

Quote:

Originally Posted by Seerah (Post 443)
It's a wiki - anyone can help out! :)

Page create and linked under Guides.

Cairenn 02/21/14 09:01 PM

Quote:

Originally Posted by Wykkyd (Post 456)
Page create and linked under Guides.

Excellent! :)

Xrystal 02/22/14 07:42 AM

Quote:

Originally Posted by Seerah (Post 455)
Nope. You can add files and even whole addons while the game is running. You just need to reload the UI for it to pick them up.

Cool, I always hated that part of wow rofl

Son of a Sailor 02/24/14 01:17 PM

Now my time with the beta will be torn between actually playing the game and working on an addon. I wish we could test them without beta access :(

gamegenius86 02/24/14 01:44 PM

Quote:

Originally Posted by Son of a Sailor (Post 533)
Now my time with the beta will be torn between actually playing the game and working on an addon. I wish we could test them without beta access :(

That would be amazing! However sadly, we cant :mad:

SDPhantom 03/01/14 02:21 PM

Seems like something I'd like to look into. I had a key for a while, but have been too busy to make it into a testing weekend. I'm on break from WoW in favor of FFXIV at the moment and am starting to miss writing addons.

Seerah 03/01/14 02:41 PM

Seerah waves SDPhantom over to the dark side...

We have cookies!

**one must be willing to pick up said cookies, they will not be delivered

Cairenn 03/01/14 04:35 PM

Cairenn holds out a nice warm mug of hot cocoa to go with Seerah's cookies.

*must also be picked up

datbunneh 03/20/14 05:35 AM

Are they going to release API with descriptions/commentary?


All times are GMT -6. The time now is 06:35 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI