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:
|
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" |
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:
|
Quote:
|
Quote:
@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 ;) |
Ok I think I understand. So I've updated the code again. How does it look now?
Lua Code:
|
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:
|
Format is:
labelname:SetColor(red, green, blue, alpha) Lua Code:
For colors see http://www.colorpicker.com/. Alpha is number between 0 and 1. Where 0 means transparent and 1 fully visible. |
I'm not sure but if you go looking in the controls API there is likely to be a SetColor() or something :) and you will need to change the <OnMouseDown> to be inside each <label> At the moment it will run when you click the frame not each label individually. You will also need to give your function the name of which label you have clicked on so it knows which one to change, have a look at sending parameters to functions in lua for that :)
It's also a good plan to pre think things before you jump into coding. When I click this what exactly do I want to happen behind the scenes it saves a lot of time later :) Most of what your looking for can be found in a quick google search :) you'll learn a lot quicker and feel like you've accomplished more if ya go digging :) |
2 Attachment(s)
This is my xml and lua. I will show a few images of what I'm getting.
XML Lua Code:
LUA Lua Code:
|
Quote:
|
Quote:
See the ScriptArguments at http://wiki.esoui.com/UI_XML#OnUpdate for example, or an example in the wild here: link. |
Please check this addon: http://www.esoui.com/downloads/info2...AddonTest.html
This addon is well commented tutorial for beginners. Just download it and read through the code. |
Quote:
Banana Attack :banana: lol sorry had to. :) |
Quote:
Edit// just had a look at your example and I get ya now xD |
All times are GMT -6. The time now is 09:36 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI