Thread Tools Display Modes
07/17/17, 03:19 PM   #1
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Adding a Tab to the Journal Screen

I considered titling this thread "Adding an Element to an Existing UI Control" but then I realised that could be too general or just outright incorrect.

What I would like to do is create an add-on listing all completed quests under a new tab in the Journal. Getting completed quests is probably the easy bit (CaptainBlagbird is already helping with that) -- the hard bit is getting that list to display as part of the native UI format rather than as its own pop-up or in chat. I hope this should technically be possible, as I've seen add-ons already adding additional tabs to the World Map; here, we're just using the Journal instead of the Map.

The new window would have a list on the left of categories, similar to the way the Active Quests list and Cadwell's Almanac tabs already work, and some of those categories would have sub-entries.

And now rather than trying to explain it further, I'm just going to put in a couple of pictures, and ask "How do I do this?"




List of things I think I need to know:
  • How to add a tab.
  • How to add a list on the left of the new tab.
  • How to make elements of that list expandable to have sub-lists.
  • How to make something appear on the right when you click something on the left.
  • How to make the thing on the right scrollable if it's too long.
  • How to make the list on the left scrollable if it gets too long.
  • How to make everything go away if you click something else.
There's probably other things too that I haven't even considered yet...

Thanks for any assistance you can provide, and if anyone would like to be a collaborator on this add-on, let me know!
  Reply With Quote
07/17/17, 11:13 PM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Adding a tab:
Lua Code:
  1. local sceneName = "<your unique scene name>"
  2. YOUR_FRAGMENT = ZO_HUDFadeSceneFragment:New(self.control)
  3. YOUR_SCENE = ZO_Scene:New(sceneName, SCENE_MANAGER)
  4. YOUR_SCENE:AddFragmentGroup(FRAGMENT_GROUP.PLAYER_PROGRESS_BAR_KEYBOARD_CURRENT)
  5. YOUR_SCENE:AddFragmentGroup(FRAGMENT_GROUP.MOUSE_DRIVEN_UI_WINDOW)
  6. YOUR_SCENE:AddFragment(FRAME_TARGET_BLUR_STANDARD_RIGHT_PANEL_FRAGMENT)
  7. YOUR_SCENE:AddFragment(FRAME_EMOTE_FRAGMENT_JOURNAL)
  8. YOUR_SCENE:AddFragment(RIGHT_BG_FRAGMENT)
  9. YOUR_SCENE:AddFragment(TITLE_FRAGMENT)
  10. YOUR_SCENE:AddFragment(JOURNAL_TITLE_FRAGMENT)
  11. YOUR_SCENE:AddFragment(CODEX_WINDOW_SOUNDS)
  12. YOUR_SCENE:AddFragment(YOUR_FRAGMENT)
  13.  
  14. SYSTEMS:RegisterKeyboardRootScene(sceneName, YOUR_SCENE)
  15.  
  16. local sceneGroupInfo = MAIN_MENU_KEYBOARD.sceneGroupInfo["journalSceneGroup"]
  17. local iconData = sceneGroupInfo.menuBarIconData
  18. iconData[#iconData + 1] = {
  19.     categoryName = SI_JOURNAL_MENU_YOUR_STRING_ID,
  20.     descriptor = sceneName,
  21.     normal = "your_up.dds",
  22.     pressed = "your_down.dds",
  23.     highlight = "your_over.dds",
  24. }
  25. local sceneGroupBarFragment = sceneGroupInfo.sceneGroupBarFragment
  26. YOUR_SCENE:AddFragment(sceneGroupBarFragment)
  27.  
  28. local scenegroup = SCENE_MANAGER:GetSceneGroup("journalSceneGroup")
  29. scenegroup:AddScene(sceneName)
  30. MAIN_MENU_KEYBOARD:AddRawScene(sceneName, MENU_CATEGORY_JOURNAL, MAIN_MENU_KEYBOARD.categoryInfo[MENU_CATEGORY_JOURNAL], "journalSceneGroup")
  31.  
  32. YOUR_SCENE:RegisterCallback("StateChange", function(oldState, newState)
  33.     if newState == SCENE_SHOWING then
  34.         -- do stuff
  35.     elseif newState == SCENE_HIDING then
  36.         -- do stuff
  37.     end
  38. end )

/edit: self.control is your TopLevelControl

Last edited by votan : 07/18/17 at 12:51 AM.
  Reply With Quote
07/18/17, 02:49 AM   #3
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Great, thanks! I'm not sure what some of those things actually mean, but I'm sure I'll work it out! Now I have the correct names for some of the elements I can search around for them

Edit: Oh dear, I need to write an XML to define my TopLevelControl, don't I? There's probably tutorials on that somewhere...

Last edited by Enodoc : 07/18/17 at 03:26 AM.
  Reply With Quote
07/18/17, 03:44 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
http://wiki.esoui.com/Circonians_Stamina_Bar_Tutorial

Scroll down to "XML structure", there should be a pretty good explanation.
Or read the other tutorials here, maybe they help as well: http://www.esoui.com/forums/showthread.php?t=6399

The wiki is your friend:
http://wiki.esoui.com/Main_Page
  Reply With Quote
07/19/17, 05:07 PM   #5
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
I managed to find out how to define the TopLevelControl using lua instead, which makes a lot more sense to me. So now I have an empty tab! Does anyone know if the definitions for the existing Quest Journal, Lore Library, and/or Achievements controls are available anywhere? They would probably be a good starting point for the interior contents, as they must have a number of child controls themselves.
  Reply With Quote
07/20/17, 12:30 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Check the addon ESOUI source, which provides the total source code including the XML files.
http://www.esoui.com/downloads/info1...ourcecode.html

Or on github: https://github.com/esoui/esoui
-> Version 3.1.0 from the actual PTS

The definitions should be somewhere in esoui/ingame/achiev* or quest*
  Reply With Quote
07/20/17, 02:16 PM   #7
CaptainBlagbird
 
CaptainBlagbird's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 53
Originally Posted by Enodoc View Post
Does anyone know if the definitions for the existing Quest Journal, Lore Library, and/or Achievements controls are available anywhere? They would probably be a good starting point for the interior contents, as they must have a number of child controls themselves.
Zgoo might also help with that (also available in Dev Tools).

Originally Posted by Baertram View Post
Check the addon ESOUI source, which provides the total source code including the XML files.
http://www.esoui.com/downloads/info1...ourcecode.html

Or on github: https://github.com/esoui/esoui
-> Version 3.1.0 from the actual PTS

The definitions should be somewhere in esoui/ingame/achiev* or quest*
Another mirror: http://esodata.uesp.net/100019/

Last edited by CaptainBlagbird : 07/20/17 at 02:19 PM.
  Reply With Quote
08/26/17, 06:37 PM   #8
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Basic functionality achieved!



http://www.esoui.com/downloads/info1...stLogbeta.html

Priority things to do now are to work out how to add categories down the left, and how to get the thing to update when a quest is completed. Also ideally some way to only load the whole list when the window is open, and unload it when it isn't, to save memory.
  Reply With Quote
08/26/17, 10:15 PM   #9
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
There's EVENT_QUEST_COMPLETE (number eventCode, string questName, number level, number previousExperience, number currentExperience, number championPoints, number questType, number instanceDisplayType) that you can add a handler to to update when a quest completes, if you're keeping an internal list of completed quests. Alternatively, you can just build the quest list each time it's opened, but that might lag the game for players with a lot of completed quests.

I believe the garbage collection is all automatic, but you might be able to clear it by setting all references of it to nil.
  Reply With Quote
08/27/17, 08:53 AM   #10
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Originally Posted by Dolgubon View Post
Alternatively, you can just build the quest list each time it's opened, but that might lag the game for players with a lot of completed quests.
Is that tied to the StateChange in Votan's lines 32 through 38? Would it be worth it to avoid maintaining a persistent internal list, or is the memory used not significant enough for that to be worthwhile?
  Reply With Quote
08/27/17, 09:16 AM   #11
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
Votan's addon has no bearing on it. When the quest window is opened, there is a function that is called. So you can hook that to reload the quest list. The quest list will take around 2-3 KB of memory, probably, which isn't too much. I think.
  Reply With Quote
08/27/17, 01:47 PM   #12
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 103
The best way I can think of to populate the completed list is to declare a variable firstrun = 1 then run a function on

EVENT_PLAYER_ACTIVATED (or maybe EVENT_ADDON_LOADED):

if firstrun == 1 then
blabla loop over quests to populate table
firstrun = 0
end

Then you can easily add entries with EVENT_QUEST_COMPLETED.

I guess you would want the table to be alphabetized? So might have to have a separate function that is called to realphabetize the list, but if you figure out how to break them into categories you could make an efficient function that only reorders the quests under that zone category on quest completion.
  Reply With Quote
08/27/17, 04:57 PM   #13
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Originally Posted by Dolgubon View Post
Votan's addon has no bearing on it. When the quest window is opened, there is a function that is called. So you can hook that to reload the quest list. The quest list will take around 2-3 KB of memory, probably, which isn't too much. I think.
Not Votan's add-on, the code he provided in this thread for how to add a new scene. Lines 32-38 of that look to be the callback for when the window is opened.

In the next version I'll try hooking it into opening the window, and get some feedback from people who've completed lots of quests to see if it lags them too much.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Adding a Tab to the Journal Screen

Thread Tools
Display Modes

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