09-16-22, 05:50 PM | #1 |
Need some help on XML to LUA
I have been working on an older addon from 2017. I have everything working except for one thing. The panel/frame is in XML. I have made a panel with LUA. But its empty. I can pull up the addon with the slash command and all the buttons are there, but no panel around it. In another words I have a blank panel (moveable, exit button) and another with all the addon buttons. Both are on my screen. Can anyone guide me in the right direction?
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Frame name="LocationMessageView" enableMouse="true" movable="true"> <Scripts> <OnLoad> <![CDATA[ self:RegisterForDrag("LeftButton") LocationMessageView:Hide() ]]>; LocationMessageView:RegisterEvent("ZONE_CHANGED_NEW_AREA"); </OnLoad> <OnDragStart>self:StartMoving();</OnDragStart> <OnDragStop>self:StopMovingOrSizing();</OnDragStop> <OnShow> </OnShow> <OnEvent>LocationMessageController:on_zone_changed(event)</OnEvent> </Scripts> <Size> <AbsDimension x="139" y="170" /> </Size> <Anchors> <Anchor point="CENTER" relativeTo="UIParent"> <Offset> <AbsDimension x="0" y="0" /> </Offset> </Anchor> </Anchors> <TitleRegion setAllPoints="true" /> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11" /> </BackgroundInsets> <TileSize> <AbsValue val="32" /> </TileSize> <EdgeSize> <AbsValue val="32" /> </EdgeSize> </Backdrop> <Frames> <Button name="AllClear" text="All Clear"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="93" y="27" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="22" y="-59" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_all_clear_button_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming" text="Incoming"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="93" y="27" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="22" y="-94" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="SendMore" text="Send More"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="93" y="27" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="22" y="-129" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_sendmore_button_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming1" text="1"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="15" y="29" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="22" y="-24" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button1_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming2" text="2"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="15" y="29" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="37" y="-24" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button2_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming3" text="3"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="15" y="29" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="52" y="-24" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button3_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming4" text="4"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="15" y="29" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="67" y="-24" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button4_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> <Button name="Incoming5" text="Zerg"> <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />--> <Size> <AbsDimension x="35" y="29" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="82" y="-24" /> </Offset> </Anchor> </Anchors> <Scripts> <OnClick>location_message_controller:on_incoming_button5_pressed()</OnClick> </Scripts> <NormalTexture file="Interface\Buttons\UI-Panel-Button-Up"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </NormalTexture> <PushedTexture file="Interface\Buttons\UI-Panel-Button-Down"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </PushedTexture> <DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </DisabledTexture> <HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD"> <TexCoords left="0" right="0.625" top="0" bottom="0.6875" /> </HighlightTexture> <ButtonText name="$parentText"> <Anchors> <Anchor point="CENTER"> <Offset> <AbsDimension x="0" y="1" /> </Offset> </Anchor> </Anchors> <FontHeight> <AbsValue val="10" /> </FontHeight> </ButtonText> <NormalFont style="GameFontNormal" /> <HighlightFont style="GameFontHighlight" /> <DisabledFont style="GameFontDisable" /> </Button> </Frames> </Frame> </Ui> Code:
local Incoming = CreateFrame("Frame", nil, PARENT_FRAME, BackdropTemplateMixin and "BackdropTemplate"); Incoming:SetBackdrop({ bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", tile=1, tileSize=32, edgeSize=32, insets={left=11, right=12, top=12, bottom=11} }) Incoming:SetWidth(139) Incoming:SetHeight(190) Incoming:SetPoint("CENTER",UIParent) Incoming:EnableMouse(true) Incoming:SetMovable(true) Incoming:RegisterForDrag("LeftButton") Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end) Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) Incoming:SetFrameStrata("FULLSCREEN_DIALOG") local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate") button:SetHeight(24) button:SetWidth(60) button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10) button:SetText("Close") button:SetScript("OnClick", function(self) self:GetParent():Hide() end) |
|
09-16-22, 07:42 PM | #2 | |
It looks like you already have a grasp on how to create UI objects and parent them. If you need a reference, there's WoWPedia's Widget API page.
The most time-consuming part of the conversion is turning XML's tree structure into a flat linear format.
__________________
WoWInterface AddOns
|
||
09-16-22, 08:16 PM | #3 | |
|
||
09-16-22, 08:17 PM | #4 |
Also, try changing the parenting from
Lua Code:
Lua Code:
The name of your XML frame (LocationMessageView) will be added to the global table and, assuming your XML file/frame loads first, you can use that as the parent in your .lua frame. This is done with the names of all frames.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-16-22, 08:23 PM | #5 | |
|
||
09-16-22, 08:32 PM | #6 |
You seem to want the XML to be parented to the .lua frame so probably more like:
Lua Code:
and you would show/hide SharpedgeFrame in your slash command I'm assuming the load order of the files based on their order in your OP.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 09-16-22 at 08:36 PM. |
|
09-16-22, 08:44 PM | #7 | |
|
||
09-16-22, 08:57 PM | #8 |
The XML is being loaded after the .lua. You don't say if your .lua file is being made part of the addon or a separate addon so I will assume separate and this should work in either case unless the original addon is Load-On-Demand.
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-16-22, 09:11 PM | #9 |
Yes its enabled on boot. But now there is nothing on my screen. Even if I use the slash /inc it just gives the options for slash in the chat window.
I really do appreciate you helping me on this. I'm still learning. |
|
09-16-22, 09:26 PM | #10 |
Is /inc showing/hiding SharpedgeFrame or whatever name you gave to the "Incoming" frame?
If the slash command is in the same .lua file as Incoming (but the code is after Incoming has been created) you can use Incoming instead.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-16-22, 09:31 PM | #11 |
On the lua you provided I changed SharpedgeFrame to IncomingFrame and get the same results. If I'm understanding your question right.
|
|
09-16-22, 09:35 PM | #12 |
Can you post all the .lua including the slash command?
Are the .lua and .xml in separate addons or included in the same .toc?
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-16-22, 09:40 PM | #13 | |
"attempt to index global" when I click a button. But all im getting on my screen is all the clickable buttons for the addon. There is is no exit button. Would you like a link to the addon itself? |
||
09-16-22, 09:44 PM | #14 |
It would help.
The global space where the frame names are stored is shared by all addons and the entire Blizzard UI so a name of "IncomingFrame" being fairly simple, might be being overwittedn by something else.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-16-22, 09:47 PM | #15 | |
|
||
09-16-22, 10:17 PM | #16 |
You're essentially taking control of another addon so you can't entirely rely on it's slash command(s). For this you will need to provide one of your own (in this case /sinc)
The .toc for your addon (the ## Dependencies: means the Incomming addon will load first.) Lua Code:
The Sharpedge.lua (or whatever you've called it) Lua Code:
use /sincor whatever you renale "/sinc" to instead of /inc
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
09-17-22, 12:18 AM | #17 | |
Code:
Message: [string "Incoming:OnClick"]:1: attempt to index global 'location_message_controller' (a nil value) Time: Sat Sep 17 01:14:36 2022 Count: 1 Stack: [string "Incoming:OnClick"]:1: attempt to index global 'location_message_controller' (a nil value) [string "*:OnClick"]:1: in function <[string "*:OnClick"]:1> Locals: self = Incoming { 0 = <userdata> } button = "LeftButton" down = false (*temporary) = nil (*temporary) = nil (*temporary) = "attempt to index global 'location_message_controller' (a nil value)" |
||
09-17-22, 01:26 AM | #18 |
Probably easier just apply a backdrop and close button to the addon frame
Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 09-17-22 at 01:32 AM. |
|
09-17-22, 03:29 AM | #19 | |
|
||
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Need some help on XML to LUA |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|