Thread Tools Display Modes
01/05/17, 04:23 AM   #1
Zinival
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
I made replacement Action Bar textures, but I need help with LUA.

I made some replacement textures for the action bar. I don't know anything about LUA yet, so I have no idea how to get them in the game properly.

I read this thread, Replace Texture Throughout UI and the Writing your first addon tutorial. I tried to follow them, but I'm just not understanding it.

Here is exactly what I put in the .lua file.

Lua Code:
  1. CleanActionBar = {}
  2. CleanActionBar.name = "CleanActionBar"
  3.  
  4.     local function Addon_Loaded(eventCode, addOnName)
  5.         if (addOnName == "CleanActionBar") then
  6.             RedirectTexture("esoui/art/actionbar/abilityframe64_down.dds", "CleanActionBar/textures/cleanabilityframe_down.dds")
  7.             RedirectTexture("esoui/art/actionbar/abilityframe64_up.dds", "CleanActionBar/textures/cleanabilityframe_up.dds")
  8.             RedirectTexture("esoui/art/actionbar/ability_keybindbg.dds", "CleanActionBar/textures/cleanability_keybindbg.dds")
  9.             RedirectTexture("esoui/art/actionbar/ultimatemeter_frame64.dds.dds", "CleanActionBar/textures/cleanultimatemeter_frame64.dds.dds")
  10.         end
  11.     end
  12.      
  13.      EVENT_MANAGER:RegisterForEvent("CleanActionBar", EVENT_ADD_ON_LOADED, Addon_Loaded)

With that, the texture replacements work, but there's no way to disable the addon once it's installed. If I disable it in the addon menu the textures from my addon still show up. What am I missing to make it work properly?

I'd really appreciate some help with this. I have some nice, pretty Action Bar textures that I'd love to share. They look great with other UI mods, and as far as I'm aware there are no other Action Bar textures available yet.

Any help or explanation would be most welcome! Please help me.
  Reply With Quote
01/05/17, 04:40 AM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lot of texture systems are only refreshed whn game restart. So reloading UI won't help you here.

But you can add a slash command or a control panel to restore the initial values (I don't know if it will work in fact ..)


To do this, you can alter a bit your code like this : I didn't tested it because not very fan of texture redirection ..



Lua Code:
  1. local ADDON_NAME = "CleanActionBar"
  2. local needToChange = true
  3.  
  4. local function ChangeTextures()
  5.  
  6.     if needToChange then
  7.         RedirectTexture("esoui/art/actionbar/abilityframe64_down.dds", "CleanActionBar/textures/cleanabilityframe_down.dds")
  8.         RedirectTexture("esoui/art/actionbar/abilityframe64_up.dds", "CleanActionBar/textures/cleanabilityframe_up.dds")
  9.         RedirectTexture("esoui/art/actionbar/ability_keybindbg.dds", "CleanActionBar/textures/cleanability_keybindbg.dds")
  10.         RedirectTexture("esoui/art/actionbar/ultimatemeter_frame64.dds.dds", "CleanActionBar/textures/cleanultimatemeter_frame64.dds.dds")
  11.     else
  12.         RedirectTexture("esoui/art/actionbar/abilityframe64_down.dds", "esoui/art/actionbar/abilityframe64_down.dds")
  13.         RedirectTexture("esoui/art/actionbar/abilityframe64_up.dds", "esoui/art/actionbar/abilityframe64_up.dds")
  14.         RedirectTexture("esoui/art/actionbar/ability_keybindbg.dds", "esoui/art/actionbar/ability_keybindbg.dds")
  15.         RedirectTexture("esoui/art/actionbar/ultimatemeter_frame64.dds.dds", "esoui/art/actionbar/ultimatemeter_frame64.dds.dds")
  16.     end
  17.    
  18.     needToChange = not needToChange
  19.    
  20. end
  21.  
  22. local function OnAddonLoaded(_, addOnName)
  23.  
  24.     if addOnName == ADDON_NAME then
  25.         SLASH_COMMANDS["/cleanactionbar"] = ChangeTextures
  26.         ChangeTextures()
  27.     end
  28.    
  29. end
  30.  
  31. EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_ADD_ON_LOADED, OnAddonLoaded)

Last edited by Ayantir : 01/05/17 at 04:42 AM.
  Reply With Quote
01/05/17, 10:29 AM   #3
Zinival
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Your code works! Thank you so much for your reply. I really appreciate your help and explanation.

Disabling the mod completely still requires a game restart, but that seems like it might be unavoidable? The slash command is a nice workaround for people that want to disable the textures without restarting.

I have two follow-up questions if you don't mind.

1. May I use your lua code in my addon if I give you credit for it?

2. You said you're not a fan of texture redirection. Is there an alternative way to do it? I can't figure out how to "replace" the textures instead of "redirect" them. If you could tell me how to do that I'd be very grateful.

Thanks again.
  Reply With Quote
01/05/17, 10:51 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,964
Replacing them at the action bar does not make any sense as the bar will be updated after each new skill placed there, sometimes if skills are used and if you change the bars from weapon set 1 to 2 and backwards.

So a redirect might be the best option here.

For other textures where a replacement makes sense:

-Download the addon Zgoo
-Use it ingame, place mouse over a control where you want to find the texture, write
Code:
/zgoo mouse
into the chat and press return key
-> As alternative go to the keyboard key settings and specify a keybind for "Zgoo mouse" and use this keybind then ("Numpad 0" is a good one imo)
-Zgoo will open and show you the control below your mosue
The name of the current control will be written at the entry ":GetName()", e.g. ZO_PlayerInventoryMenubarButton1
-Find the texture of this control by opening the :GetChildren() function and see the controls that are children of the current control.
-Select the one named "Image" or "Texture" or simlar, where the type CT_TEXTURE is writtne behind in light blue color.

The selected texture name is the red tetx in front of the CT_TEXTURE, e.g.
ZO_PlayerInventoryMenubarButton1Image
-Press the "+" in front of it to see the controls info of that texture.
-At the function entry :GetTextureFileName() you'll see the .dds file of that texture control

Via ZO_PlayerInventoryMenubarButton1Image:SetTexture(pathToDDSFileName) you're able to set a new dds file to it.
  Reply With Quote
01/05/17, 12:08 PM   #5
Zinival
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Thanks Baertram! The information you gave is very helpful.

I was struggling to figure out how to work with textures in this game, so I greatly appreciate the detailed instructions you wrote out for me.

Since you seem to think redirect is the best option for the action bar, and I got it working currrently (with Ayantir's help), then I'll probably stick with that.

Thanks very much.
  Reply With Quote
01/05/17, 01:23 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,964
If you were just trying to remove the action bar borders around the skills, the addon author blakbird had written this small addon attached in the past to achieve the goal.
Hope it still works and you can look at the code.

It does not use the redirectTexture method but another approach.
Attached Files
File Type: zip NoActionbarBorders_0_0_1.zip (1.5 KB, 295 views)
  Reply With Quote
01/05/17, 01:50 PM   #7
Zinival
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
I actually made new border textures that I want to use, so I'm not trying to remove them.

Still, I might be able to use part of that code to do what I want to do. The comments in it are very helpful for explaining what the code does. It's so nice when people add comments to the code for noobs like me!

Thank you again. I appreciate you taking the time to help me figure this stuff out.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » I made replacement Action Bar textures, but I need help with LUA.


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