ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Addon Tutorial, got it to work, changed something, now I can't make it work again. (https://www.esoui.com/forums/showthread.php?t=744)

Mrwhitepantz 04/09/14 08:12 PM

Addon Tutorial, got it to work, changed something, now I can't make it work again.
 
I am seriously at a loss here. I got this counter business to work, and then I tried to change the name from "MyFirstAddon" to "ControllerIcons" and it stopped working. Now I've changed everything back from what I can tell, and it still won't show up in the game.

XML
Code:

<GuiXml>
  <Controls>
    <TopLevelControl name="MyFirstAddon" mouseEnabled="true">
      <Dimensions x="200" y="42" />
      <Anchor point="CENTER" />
     
      <OnUpdate>
        MyFirstAddonUpdate()
      </OnUpdate>
     
      <OnMouseDown>
        MyFirstAddonReset()
      </OnMouseDown>
     
      <Controls>
        <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
        <Label name="$(parent)Counter" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Counter: ">
          <AnchorFill />
        </Label>
      </Controls>
    </TopLevelControl>
  </Controls>
</GuiXml>

LUA
Code:

local counter = 1

function MyFirstAddonUpdate()
  MyFirstAddonCounter:SetText(string.format("Counter: %d", counter))
  counter = counter + 1
end

function MyFirstAddonReset()
  counter = 0
end

Can someone please tell me where I'm being dumb at? Thanks.

Sharp 04/10/14 05:42 AM

Code:

<TopLevelControl name="MyFirstAddon" mouseEnabled="true">
If you change the name here, you'll need to change it in the LUA because of this code here also in the XML

Code:

<Label name="$(parent)Counter" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Counter: ">
$(parent)Counder means it will evaluate to MyFirstAddonCounter

And you have to change the LUA here:

Lua Code:
  1. MyFirstAddonCounter:SetText(string.format("Counter: %d", counter))

If you change it from MyFirstAddon, you'll need to replace all instances where it was. Once you change those, it should work.


All times are GMT -6. The time now is 12:28 PM.

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