Thread Tools Display Modes
04/28/14, 01:36 AM   #1
arkemiffo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
XML Noob begging for assistance.

Hello.

I'm about to make my first addon for ESO (for any game at all for that matters).
It's a simple thing that takes up to 3 wanted potion effects and spits out all the possible combinations for those effects. The lua script is done, and working in text format at the moment (the wanted effects are hardcoded at the moment into a table and in the end it prints out the final result table of all combinations).

What I need now is some help to get me started on the GUI for the addon, and how to connect the GUI to the lua script. I've understood as much as I have events that I have to bind in my script, and use in the XML file for different controls, but that's just about as far as I have got. I've tried to look at other addons to learn myself, but they are far above my head at the moment. Is there somewhere where the XML is explained from a beginner level and up?

All I would like is to have 3 dropdowns, one for each wanted effect, and a result frame where the text is being presented (this would be good enough for now anyway, linking items and such comes later).

All help appreciated.
  Reply With Quote
04/28/14, 03:29 AM   #2
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
Have you looked at http://wiki.esoui.com/MyFirstAddon_tutorial ? There is a simple example of a label control. It shows how to set the label's text.
  Reply With Quote
04/28/14, 06:08 AM   #3
arkemiffo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Yeah, I had a look at it, and tried it out. While it works perfectly for what it is, it gives you nothing about the actual functionality of the XML.
I tried to change the text attribute for example, and I couldnt see it made any difference at all, so why is it there? What does it do?
Changing the string in lua does change it however, so why even bother with the XML attribute?

I still haven't the first clue about how to create a dropdown with a selection of the effects possible for example.

Is the XML interface similar enough to WoW to go through the wowwiki for example and learn from there?

Thanks for the reply anyway.


I just noticed the GUI section on the wiki. Somehow that one has evaded my eyes so far, but it is basically what I was asking for. A more detailed instruction on the XML functions.
Is it a new section? If not, then I must apologize profusely for making an unnecessary post here.

Thanks for the help nonetheless.

Last edited by arkemiffo : 04/28/14 at 07:01 AM. Reason: Just realized I may have missed the part of the wiki that I was looking for.
  Reply With Quote
04/28/14, 07:09 AM   #4
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
I don't know about the WoW api similarity but I can help you by showing you how i would do it:

First to define some button in you XML (inside <Controls> element, inside <TopLevelControl>):
Code:
<Button name="$(parent)OpenDropdown" inherits="ZO_DropdownButton">
   <Anchor .../>
   <OnMouseDown>
      ToggleMyDropdown(self)
   </OnMouseDown>
</Button>
Then in your lua code:

Lua Code:
  1. local hidden = true
  2. function ToggleMyDropdown(control)
  3.    hidden = not(hidden)
  4.    if hidden then
  5.       ClearMenu()
  6.    else
  7.       ClearMenu()
  8.       AddMenuItem("Item1", function() d("item1") end)
  9.       AddMenuItem("Item2", function() d("item2") end)
  10.       AddMenuItem("Item3", function() d("item3") end)
  11.       SetMenuHiddenCallback( function() hidden = true end )
  12.       ShowMenu(cotrol,1)
  13.    end
  14. end
This is not working example so you should figure out where to put the button, what attributes to set and so on.

Edit:
the GUI section is here already for some time now

Edit2:
added SetMenuHiddenCallback()

Last edited by Harven : 04/28/14 at 08:35 AM.
  Reply With Quote
04/28/14, 07:23 AM   #5
arkemiffo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
This is really great.
At work now though, but I will fiddle around with it when I'm back home.
Thank you so much for the help.

As for the GUI section, all I can say is that I'm not a clever man apparently.

You have my sincere gratitude.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » XML Noob begging for assistance.


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off