Thread Tools Display Modes
04/15/14, 08:09 AM   #1
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
Help with my xml coding

This is my xml code so far. What I'm trying to do is have a box with a list of quests in it and later in my lua I want to make each quest clickable so that the text well turn to a dark gray and if they click it again it'll go back to the original color. I currently have just two quest in it. How I want it to look is like this example below.

A Pinch of Sugar
Cast Adrift

My question is if my code has errors and if so what do I need to do to fix them so far?

Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="QuestMaster" mouseEnabled="true" movable="true">
  4.             <Dimensions x="300" y="400" />
  5.             <Anchor point="CENTER" />
  6.  
  7.             <OnUpdate>
  8.                 QuestMasterUpdate()
  9.             </OnUpdate>
  10.  
  11.             <OnMouseDown>
  12.                 QuestMasterReset()
  13.             </OnMouseDown>
  14.  
  15.             <Controls>
  16.                 <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
  17.                 <Label name="$(parent)" font="ZoFontAnnounceSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="A Pinch of Sugar">
  18.                 <Label name="$(parent)" font="ZoFontWindowSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Cast Adrift">
  19.                     <AnchorFill />
  20.                 </Label>
  21.             </Controls>
  22.         </TopLevelControl>
  23.     </Controls>
  24. </GuiXml>
  Reply With Quote
04/15/14, 09:04 AM   #2
Ouijan
 
Ouijan's Avatar
Join Date: Apr 2014
Posts: 13
I can't test it right now (Server is down) but I'm pretty sure u need to close your first <label> tag and add an <AnchorFill /> to it To display them they way you want you will have to look into anchors and offsets you could either just offset them each a certain distance OR anchor the top of one to the bottom of the one above it which is a bit trickier

As for the functions what do you plan to do with QuestMasterUpdate() and QuestMasterReset()?

Edit: also you need to give your <Label>s different names currently both of them will be named "QuestMaster"
  Reply With Quote
04/15/14, 09:23 AM   #3
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
Here is my updated code so far. And as for the QuestMasterUpdate & QuestMasterReset I'm not sure yet I want to make the text change colors to dark gray and if they click on it again turn back to the original color. I don't know exactly if I need to pull the update and reset out or if they can be used for the text color.

Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="QuestMaster" mouseEnabled="true" movable="true">
  4.             <Dimensions x="300" y="400" />
  5.             <Anchor point="CENTER" />
  6.  
  7.             <OnUpdate>
  8.                 QuestMasterUpdate()
  9.             </OnUpdate>
  10.  
  11.             <OnMouseDown>
  12.                 QuestMasterReset()
  13.             </OnMouseDown>
  14.  
  15.             <Controls>
  16.                 <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
  17.                 <Label name="$(parent)" font="ZoFontAnnounceSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="A Pinch of Sugar">
  18.                     <AnchorFill />
  19.                 </Label>
  20.                 <Label name="$(parent)" font="ZoFontWindowSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Cast Adrift">
  21.                     <AnchorFill />
  22.                 </Label>
  23.             </Controls>
  24.         </TopLevelControl>
  25.     </Controls>
  26. </GuiXml>
  Reply With Quote
04/15/14, 09:23 AM   #4
Total-Khaos
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 6
Originally Posted by Ouijan View Post
I can't test it right now (Server is down) but I'm pretty sure u need to close your first <label> tag and add an <AnchorFill /> to it To display them they way you want you will have to look into anchors and offsets you could either just offset them each a certain distance OR anchor the top of one to the bottom of the one above it which is a bit trickier

As for the functions what do you plan to do with QuestMasterUpdate() and QuestMasterReset()?

Edit: also you need to give your <Label>s different names currently both of them will be named "QuestMaster"
You saw the same things I did.
  Reply With Quote
04/15/14, 10:10 AM   #5
Ouijan
 
Ouijan's Avatar
Join Date: Apr 2014
Posts: 13
Originally Posted by Total-Khaos View Post
You saw the same things I did.
tehe

@Zireko
Cool man getting there! you need to give EVERYTHING on the screen a different name otherwise the game will have issues drawing it (learnt from experience xD) so where you have each <Label name="$(parent)"> it is essentially saying <Label name="QuestMaster"> because the parent frame of each label is your TopLevelControl which is named "QuestMaster". Currently your backdrop will be named it "QuestMasterBG" which is good, so stick something after the "$(parent)" in your <Label>s

The name of each frame is its identifier, you cant have two frames with the same name or the ui freaks out and doesn't know which frame to do what to :P

For the functions you only really need to have one function in the <OnMouseDown> (or <OnMouseUp> your choice) to toggle between two colours when clicked at the moment you don't need an OnUpdate
  Reply With Quote
04/15/14, 10:21 AM   #6
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
Ok I think I understand. So I've updated the code again. How does it look now?

Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="QuestMaster" mouseEnabled="true" movable="true">
  4.             <Dimensions x="300" y="400" />
  5.             <Anchor point="CENTER" />        
  6.  
  7.             <OnMouseDown>
  8.                 QuestMasterReset()
  9.             </OnMouseDown>
  10.  
  11.             <Controls>
  12.                 <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
  13.                 <Label name="$(parent)quest1" font="ZoFontAnnounceSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="A Pinch of Sugar">
  14.                     <AnchorFill />
  15.                 </Label>
  16.                 <Label name="$(parent)quest2" font="ZoFontWindowSmall" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Cast Adrift">
  17.                     <AnchorFill />
  18.                 </Label>
  19.             </Controls>
  20.         </TopLevelControl>
  21.     </Controls>
  22. </GuiXml>
  Reply With Quote
04/15/14, 10:40 AM   #7
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
This is the little lua I have currently I know it's geared for the counter from the tutorial. But I have taken out the Update part because I do not need it. What I'm asking here is how do I change this code so that instead of reset it would change the color to gray text instead.

Lua Code:
  1. local counter = 1
  2.  
  3. function QuestMasterReset()
  4.     counter = 0
  5. end
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Help with my xml coding


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