Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:Earth (AddOn)/Using earth to create a QuestLog
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Displaying the Quest List == Hey, that wasn't so bad! Just a couple of loops. We've saved a lot of frustration from our user's end, too! Okay, so now we have a fancy function to get all of the quests for the current player. Let's use this instead of our dummy data. function PartyQuests_Frame_OnLoad() local ebf = getglobal(this:GetName().."Tree".."ExpandButtonFrame"); ebf:SetPoint("TOPLEFT", ebf:GetParent():GetName(), "TOPLEFT", 50, 1); getglobal(this:GetName().."ExitButton"):Hide(); getglobal(this:GetName().."TitleText"):SetText(PARTYQUESTS_TITLE_TEXT); ''local questTree = PartyQuests_GetPlayerQuestTree();'' EarthTree_LoadTable( getglobal(this:GetName().."Tree"), questTree, { onClick = function(a) Sea.io.printTable(a); end; } ); EarthTree_UpdateFrame( getglobal(this:GetName().."Tree") ); end ;Ick!! What's this? The questTree didn't load? Oh no! What happened? : A) The quest log isn't always available OnLoad, so we need to wait for a bit before getting the info. We'll do this by moving all of the update code into another function: function PartyQuests_LoadGui () local frame = PartyQuestsFrame; local tree = PartyQuests_GetPlayerQuestTree(); -- Load up the data EarthTree_LoadTable( getglobal(frame:GetName().."Tree"), eTree ); -- Draw the data EarthTree_UpdateFrame( getglobal(frame:GetName().."Tree") ); end [[Image:Earth_tutorial_1.jpg|thumb|A table-accurate parsing of the data]] Then we'll add something to the PartyQuests_Frame_OnLoad() function: -- Event Handlers -- function PartyQuests_Frame_OnLoad() ''Chronos.afterInit(PartyQuests_LoadGui);'' local ebf = getglobal(this:GetName().."Tree".."ExpandButtonFrame"); ebf:SetPoint("TOPLEFT", ebf:GetParent():GetName(), "TOPLEFT", 50, 1); getglobal(this:GetName().."ExitButton"):Hide(); getglobal(this:GetName().."TitleText"):SetText(PARTYQUESTS_TITLE_TEXT); end [[Chronos.afterInit]] is a really nice tool, that lets us do something after the game-world has started. In our case, its populating our quest list and refreshing. Using code like this helps ensure we run into fewer errors, but we need to change all of the '''''this''''' references into '''''frame''''' references. So reload and you'll see that will cause the EarthTree to parse our tree by type, as well as create sublists for all of the members of this table. Check out the result! Not bad, eh?
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)