Thread Tools Display Modes
11/04/18, 11:01 PM   #1
Pollox
AddOn Author - Click to view addons
Join Date: Nov 2018
Posts: 6
Pollox's Daily Quest Tracker [Alpha]

This is my first addon for ESO, and first time writing in LUA, so I welcome general code review as well as testing. This addon tracks which of the repeatable daily quests your character is currently eligible to complete this day. I can't test the DLC quests, as I only own Summerset, Morrowind, and the base game, but I've added all of them to the addon.

The code is currently here:
https://github.com/Pollox/PolloxsDailyQuestTracker

I'll publish to esoui after a bit more work and testing. To use this, download to your Addons folder. Then set a keybinding to toggle the window on and off.

Specifically, I'd be interested in feedback on the following from other developers, but I welcome any feedback:
  • To update a control's texture based on a value from lua, I store a reference to the control in lua when it's created, and use that reference later to update it. Is there a better way to couple the data to the gui?
  • I started work on localization, but was confused by the various ways I've seen other addons do this. Any advice on the best way to proceed with my localization code?
  • Do control names have to be unique across my entire application, or can I use the parent control as a scope for it? For example, my controls use $(parent) as a prefix for the name, which leads to long names with several prefixes the more I nest my controls.

For testers, please note the following known limitations
  • The addon currently does not distinguish between a quest you picked up, and one that someone shared with you.
  • If you pick up a quest one day, but don't turn it in until the next day, the app will assume you are eligible to do your daily quest still. This is usually true, but in some cases you might get assigned the same daily quest that next day (e.g. same world boss), in which case the game actually won't give you a new daily quest.
  • Currently only English is supported.

I'm also interested in future feature ideas, which of my feature ideas you would use, and whether you find this addon useful in general.

Here's some future feature ideas I have:
  • Support for other languages
  • A better gui
  • Add multiple characters to interface so you can see all of them at a glance
  • Automatically hide content you don't own or have access to with ESO+
  • Show all the quests of a certain type (probably on a separate tab). For example, show status of all the different Group Boss quests in Summerset, in case you are doing quest sharing and don't want to sign up for one you've already completed.
  • Undaunted Pledges
  • Weekly trial timer
  • Filter options: quest type (world boss, delve, etc.), characters to track
 
11/05/18, 03:23 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
If you got questions check the Wiki first and maybe visit us in the gitter ESOUI chat:
https://gitter.im/esoui/esoui

I'd say you start with reading this great tutorials first toi get more details about ESO and lua API:
https://wiki.esoui.com/Writing_your_first_addon
https://wiki.esoui.com/SimpleNotebookTutorial/part1

Originally Posted by Pollox View Post
To update a control's texture based on a value from lua, I store a reference to the control in lua when it's created, and use that reference later to update it. Is there a better way to couple the data to the gui?
Yeah, most of the time the texture controls will be created with a unique name and then youa ccess them this way.
You can also create a globalk name for your addon like
Lua Code:
  1. myAddonGlobalName = myAddonGlobalName or {}

myAddonGlobalName is a tbale then and you can add other subtables and add all controls to this subtable then like this:
Lua Code:
  1. myAddonGlobalName.myTextureControls = {}
  2. myAddonGlobalName.myTextureControls["textureForButton1"] = myTextureControl


Texture control texture change:
You define the texture control and you can then add the textures to use (pressed down, mouse over, up disabled) to this control as attributes like
Code:
myTextureControl.upTex = "/esoui/art...dds"
myTextureControl.downTex = "/esoui/art...dds"
In your code you could then easily use
Lua Code:
  1. myTexture:SetTexture(myTexture.downTex)
.

It depends on the texture control! If it's a button you can set the textures for up, down etc. before properly to the given button texture slots and it will handle it on it's own.

Maybe check the addon AdvancedFilters how it uses the textures. They are stored in the file textures.lua like this:
Lua Code:
  1. local textures = {
  2.     All = "esoui/art/inventory/inventory_tabicon_all_%s.dds",
  3. }
In the code the placeholder %s is replaced then with the state, like up, down, disabled:

Lua Code:
  1. local icon = {
  2.         up = string.format(iconPath, "up"),
  3.         down = string.format(iconPath, "down"),
  4.         over = string.format(iconPath, "over"),
  5.     }
  6.  
  7.  local button = WINDOW_MANAGER:CreateControlFromVirtual(self.control:GetName() .. subfilterName .. "Button", self.control, "AF_Button")
  8.     local texture = button:GetNamedChild("Texture")
  9.     local highlight = button:GetNamedChild("Highlight")
  10.  
  11.     texture:SetTexture(icon.up)
  12.     highlight:SetTexture(icon.over)
  13.  
  14. local function OnMouseEnter(thisButton)
  15.         ZO_Tooltips_ShowTextTooltip(thisButton, TOP, AF.strings[subfilterName])
  16.  
  17.         local clickable = thisButton.clickable
  18.         local active = self:GetCurrentButton() == thisButton
  19.  
  20.         if clickable and not active then
  21.             highlight:SetHidden(false)
  22.         end
  23.     end
  24.  
  25.     local function OnMouseExit()
  26.         ZO_Tooltips_HideTextTooltip()
  27.  
  28.         highlight:SetHidden(true)
  29.     end
  30.  
  31.  
  32.   button:SetHandler("OnClicked", OnClicked)
  33.     button:SetHandler("OnMouseEnter", OnMouseEnter)
  34.     button:SetHandler("OnMouseExit", OnMouseExit)
  35.  
  36.     button.texture = texture
  37.     button.up = icon.up
  38.     button.down = icon.down

AdvancedFilters creates a new "virtual control" (a kind of a template to use for your addon) "AF_Button" (given as last parameter in WINDOW_MANAGER:CreateControlFromVirtual). This AF_Button is defined in the XML file so the texture and highlight controls are added to the standard control automatically and you are able touse it.

Code:
<!-- Base Button -->
        <Button name="AF_Button" font="ZoFontGameMedium" virtual="true" hidden="false">
            <Dimensions x="32" y="32" />

            <Controls>
                <Texture name="$(parent)Texture" hidden="false">
                    <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" />
                    <Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT" />
                </Texture>

                <Texture name="$(parent)Highlight" hidden="true" blendMode="ADD">
                    <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" />
                    <Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT" />
                </Texture>
            </Controls>
        </Button>
Originally Posted by Pollox View Post
I started work on localization, but was confused by the various ways I've seen other addons do this. Any advice on the best way to proceed with my localization code?
Best approach imo is using the txt file to load different <langugage>.lua files depending on your client's language.
Your addon.txt (manifest) just uses a game's variable $(language) which provides the client language in this format: 2characters, e.g. en, or de or fr or jp or ru or es or ...

So just load a base file which contains the strings in e.g. English like this:
Code:
/lang/base.lua
And then add a line below to load the file for the client language dynamically using:
Code:
/lang/$(language).lua
In your base file define the strings
Lua Code:
  1. ZO_CreateStringId(GLOBALLY_UNIQUE_STRING_ID, "Translation")
-> GLOBALLY_UNIQUE_STRING_ID is an integer variable, a constant. The name should start with SI_ + your addon name, e.g.
Code:
SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT
SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT_TT  for the tooltip
This is missing in the wiki:
Do not just overwrite the translated strings using the same function as it was created, ZO_CreateStringId!
In the client language files "safe overwrite" them with a newer version in teh client's language:
SafeAddString(SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT, "Translated text here", 1)
The 1 is the version I think.
So this will provide you the translated string into the variable SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT

You can read the text from the variables then via AP function
Lua Code:
  1. GetString(SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT)

So just put the GetString into your addons code at e.g. LAM settings menu
Lua Code:
  1. name = GetString(SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT),
  2. tooltip = SI_YOURADDON_SETTINGS_ONLY_IN_COMBAT_TT),

Description can be found here:
https://wiki.esoui.com/How_to_add_localization_support

Originally Posted by Pollox View Post
Do control names have to be unique across my entire application, or can I use the parent control as a scope for it? For example, my controls use $(parent) as a prefix for the name, which leads to long names with several prefixes the more I nest my controls.
You can define a top level control and assign your controls to it. You can do that by using XML or lua code, your choice.
See the wiki for examples:
https://wiki.esoui.com/Writing_your_...ical_component

Last edited by Baertram : 11/05/18 at 03:38 AM.
 
11/05/18, 01:11 PM   #3
Pollox
AddOn Author - Click to view addons
Join Date: Nov 2018
Posts: 6
Thanks Baertram for your very detailed reply! I'll be sure to check all those things out.
 
08/19/21, 09:30 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Was released but seems abandoned. Inofficial update: https://www.esoui.com/downloads/info...er-Update.html
 

ESOUI » AddOns » Alpha/Beta AddOns » Pollox's Daily Quest Tracker [Alpha]

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