Creating first addon - Talking Head Frame - Help please
Hi all,
I'm quite impressed with how ElvUI has styled the Talking Head Frame and wanted to do something similar but use the vanilla wow ui. I'm very new to LUA coding and this is my first addon creation for WoW and would really like to get it working. I have tested the codes below in-game using the "/run XX" to see if it would have the desired changes I want - and it does! I noticed it has to be reapplied each time the Talking Head Frame is loaded. I though it would be best to include this in an addon rather than macro format hence why I wanted to create this addon. Below is my code - it would be very much appreciated if you can assist with getting this working or perhaps someone create this option in their own addon or something similar. Any help is much appreciated thanks! Code:
local TalkingHeadFrame = CreateFrame("FRAME","THF") |
You could try this: https://addon.bool.no/
It will convert whatever lua code into an addon. |
Quote:
Code:
Message: ...terface\AddOns\TalkingHeadFrame\TalkingHeadFrame.lua:6: attempt to index field 'BackgroundFrame' (a nil value) |
You are creating a new TalkingHeadFrame basic frame. ( First Line )
You are then trying to adjust contents that don't exist as you haven't created them. ( Inside the event function ). If you have grabbed code from the ElvUI addon make sure you haven't missed any file content that are used by the code you have utilised from the addon. Such as an XML code block that defines the frame, or the creation code that defines the frame layout in the lua file. |
As Xrystal noted, you need to adjust the TH frame from the Blizzard addon, not one you've created.
Lua Code:
|
Thanks a lot for the replies and help guys. Xrystal - thank you, helps me understand what was going wrong and I was able to look into the right area. Fizzlemizz thank you for helping me with the code as well.
I have had to modify it slightly as the Text font wasn't actually updating to the values I wanted. The modification below: Lua Code:
With the above - the first time the Talking Head appears - the styling is perfect. Any subsequent messages do not appear to retain the "Text" styling but keeps the Lua Code:
I have looked at how other AddOn authors have modified the TH frame and using their methods I was able to style it correctly (although a lot of the code is "merged together" with my styling so I may not be doing this efficiently). Below is my completed one - any recommendations or improvements will be much appreciated. Lua Code:
|
If you are running any other addon(s) that alter the TH frame, they might be "undoing" your code.
With what you have, it's probably easier to reduce all the code (after making a copy) to just: Lua Code:
and add the following to your addons .toc file: Code:
## LoadOnDemand: 1 You only need the other "plumbing" if the addon will be doing other things as well. |
Fizzlemizz thanks so much for helping with that!
Definitely helped cut down a lot of the additional lines I had added in. It still didn't update the "subsequent" messages from the Talking Head Frame. I was able to resolve this by changing the Hook script to a "hooksecurefunc" instead and use the function "TalkingHeadFrame_PlayCurrent" to update the text each time. Lua Code:
|
All times are GMT -6. The time now is 12:00 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI