Thread Tools Display Modes
04/13/15, 02:17 PM   #1
blakbird
 
blakbird's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 30
[Request] Remove Action Button Borders

Garkin as been kind enough to help me out with a couple things I have been working on for my flat, minimalist UI. He gave me this snippet of code that removes the borders on the action buttons:

Code:
for slotNum = 3, 9 do
        local button = ZO_ActionBar_GetButton(slotNum).button
        button:SetNormalTexture("")
        button:SetPressedTexture("")
        button:SetDisabledTexture("")
        end
If I run it as a script in the game, it works. Unfortunately, I am unable to figure out how to turn that script into a addon. I was able to put that code into Luminary Action Bar at line 292 and it works. But, the problem I am having with both the script and the addon is that when I swap bars or get a loading screen, the buttons go back to having borders. I have to reload the UI or run the script every time to get those borders to disappear. I don't want to keep bugging Garkin with all my issues, so hopefully someone here is able to assist me with this.
  Reply With Quote
04/13/15, 02:34 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,990
I think you need to put it into the callback function of the event_player_activated so it gets called everytime a zonechage/reloadui takes place:
Lua Code:
  1. local function Callback_Player_Activated(...)
  2. --remove borders at action buttons
  3. for slotNum = 3, 9 do
  4.         local button = ZO_ActionBar_GetButton(slotNum).button
  5.         button:SetNormalTexture("")
  6.         button:SetPressedTexture("")
  7.         button:SetDisabledTexture("")
  8.         end
  9. end
  10.  
  11. --Put this somewhere where your addon gets initialized, e.g. inside callback function of EVENT_ADDON_ON_LOAD or just at the bottom of your addon   
  12. --Register for the zone change/player ready event
  13.     EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)

Like written in the code the addon should load some function as it loads up, by event EVENT_ADDON_ON_LOAD. Replace MyAddonName with the name of your addon, like the lua filename is.

Lua Code:
  1. local function Addon_Loaded(eventCode, addOnName)
  2. --Is this addon found? Put your addon's name here!!!
  3.     if(addOnName ~= "MyAddonName") then
  4.         return
  5.     end
  6.     --Unregister this event again so it isn't fired again after this addon has beend reckognized
  7.     EVENT_MANAGER:UnregisterForEvent("MyAddonName", EVENT_ADD_ON_LOADED)
  8.  
  9.     --Register for the zone change/player ready event
  10.     EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)
  11.  
  12. end

At the bottom of your addon's lua file put this then to register the event on addon load callback function:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MyAddonName", EVENT_ADD_ON_LOADED, Addon_Loaded)


About the weapon bar change:
I do not know how to check on this but I'll have a look.

EDIT:

There is an event for this too. So put this into the ON ADDOn LOAD event callback function:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("YourAddonName", EVENT_ACTIVE_WEAPON_PAIR_CHANGED, WeaponSwapped)

And this somewhere above:

Lua Code:
  1. local function WeaponSwapped(...)
  2. --remove borders at action buttons
  3. for slotNum = 3, 9 do
  4.         local button = ZO_ActionBar_GetButton(slotNum).button
  5.         button:SetNormalTexture("")
  6.         button:SetPressedTexture("")
  7.         button:SetDisabledTexture("")
  8.         end
  9. end
  10. end

As the code is duplicate now try to put it in a nother local function and then call the function inside the Weapon swapped callback function AND the player activated function instead.

Last edited by Baertram : 04/13/15 at 02:39 PM.
  Reply With Quote
04/13/15, 03:45 PM   #3
blakbird
 
blakbird's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 30
Thanks for the help! I am very new to learning lua. I mostly dissect code and make changes to see how it works. Is there more to this code than what you have showed me? I tried to put that code together as you instructed(and a few other ways), but I keep getting errors (due to me not having the skills to deduce why the errors are happening). If you have the time, can you please show me what this code looks like all together? I didn't intend to have someone write this addon for me, but I can see that it is way beyond my current coding skillset.
  Reply With Quote
04/13/15, 04:08 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,990
A better way to learn from each other is you post us your code and we can tell you what you could do better/another way.

My example code from above would look like this, where your new addon's name would be "NoActionbarBorders" (filename would be the same + .lua, and the manifest file + .txt at the end, and create a new folder with the addon#s name and put the lua and txt file in there, and this folder then as a subfolder into the "Addons" folder):


Lua Code:
  1. --Just a function to reduce redundant code
  2. local function RemoveActionbarBorders()
  3.     --remove borders at action buttons
  4.     for slotNum = 3, 9 do
  5.             local button = ZO_ActionBar_GetButton(slotNum).button
  6.             button:SetNormalTexture("")
  7.             button:SetPressedTexture("")
  8.             button:SetDisabledTexture("")
  9.     end
  10. end
  11.  
  12. --Callback function for the player activated event (upon zone change or logging in new)
  13. local function Callback_Player_Activated(...)
  14.     RemoveActionbarBorders()
  15. end
  16.  
  17. --Callback function for the weapon swap event
  18. local function Weapon_Swapped(...)
  19.     RemoveActionbarBorders()
  20. end
  21.  
  22. --Put this somewhere where your addon gets initialized, e.g. inside callback function of EVENT_ADDON_ON_LOAD or just at the bottom of your addon
  23. --Register for the zone change/player ready event
  24.     EVENT_MANAGER:RegisterForEvent("NoActionbarBorders", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)
  25.  
  26. --Callback function for the addon loaded event (executes for EVERY addon that loads!)
  27. local function Addon_Loaded(eventCode, addOnName)
  28.     --Is THIS addon HERE found?
  29.     if(addOnName ~= "NoActionbarBorders") then
  30.         return
  31.     end
  32.     --If you got here your addon is found so execute the following code lines:
  33.     --Unregister this event again so it isn't fired again after this addon has beend loaded
  34.     EVENT_MANAGER:UnregisterForEvent("NoActionbarBorders", EVENT_ADD_ON_LOADED)
  35.     --Register for the zone change/player ready event
  36.     EVENT_MANAGER:RegisterForEvent("NoActionbarBorders", EVENT_PLAYER_ACTIVATED, Callback_Player_Activated)
  37.     --Register the callback function for the weapon bar switch
  38.     EVENT_MANAGER:RegisterForEvent("NoActionbarBorders", EVENT_ACTIVE_WEAPON_PAIR_CHANGED, Weapon_Swapped)
  39. end
  40.  
  41. --Register the event ADD_ON_LOADED to get started with your addon. As this event will be called for EVERY addon you need to
  42. --check your addon#s name inside the cllback function so it won't execute your code for EVERY addon!
  43. EVENT_MANAGER:RegisterForEvent("NoActionbarBorders", EVENT_ADD_ON_LOADED, Addon_Loaded)

I did not test this so it might contain errors. But I hope you get the point and it helps you!

EDIT:
I did test it now and it is working fine. You notice a small flickering of the borders at a weapon change but I think you won't be able to change this without replacing the textures for the borders with some other textures, or NO textures.
There is some command for lua to exchange/replace existing textures but I do not know if you are able to do this with these action bar textures as well.
search the forum for "replace texture" or "exchange texture" and use the addon "TextureIt" to find the textures for the action bars and then you might get it to work.

Last edited by Baertram : 04/13/15 at 04:21 PM.
  Reply With Quote
04/13/15, 04:12 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,990
The .txt manifest file would look like this, for example:

Code:
## Title: NoActionbarBorders
## APIVersion: 100011
## SavedVariables: NoActionbarBorders_SavedVariables
## Description: This addon will remove the borders around the action bar skills
## Version: 0.0.1
## Author: blakbird

NoActionbarBorders.lua
SavedVariables name, author name, description and version is up 2 you.
APIversion should be the most current one so the addon is not listed as outdated inside the ESO game addon manager.
  Reply With Quote
04/13/15, 04:36 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,990
Found the thread with that replace texture function. It's name is
"RedirectTexture(string oldTexturefilename, string newTextureFileName)"

http://www.esoui.com/forums/showthre...eplace+texture
  Reply With Quote
04/13/15, 04:45 PM   #7
blakbird
 
blakbird's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 30
I copied the lua code and saved it as NoActionbarBorders.lua. I copied the text file info and saved it as NoActionbarBorders.txt. I can see the addon is loaded in game, but it does nothing. I'm not completely new to programming as I used to be a web designer, but looking at lua, I can only see why working code works. I just can't see why code doesn't work.

I will check out that thread you linked now about replacing the textures.
  Reply With Quote

ESOUI » AddOns » AddOn Search/Requests » [Request] Remove Action Button Borders


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