Thread Tools Display Modes
08-16-19, 06:49 AM   #1
ChandlerJoseph
A Fallenroot Satyr
Join Date: Aug 2019
Posts: 20
Chat Code Help

For context all the elements of the chat should be hidden until your cursor is over top it, except the FontStringContainer.

So I have a few problems with my code. First, even though the tab text is set to "SetAlpha(0)" on load it is being overwritten somehow and appears on load.

Second, when I get a private message on a tab that isnt open I would like if the tab would appear but im not sure how I would do so.

Third, calling the "OnEnter()" and "OnLeave()" function I have created for "CombatLogQuickButtonFrameButton1" and "CombatLogQuickButtonFrameButton2" results in a lua error.
Here is the error if needed: https://pastebin.com/gkh1h35e

Also I couldnt figure out how to call my number table for "SetupHooks" so I had to put the individual frame number. Maybe there is a way to fix that.

Finally here is my code: https://pastebin.com/2TkPA1wJ

Hopefully everything is concise and easy to understand as well as not overwhelming for anyone willing to help! Thank you and have a wonderful day!
  Reply With Quote
08-16-19, 03:47 PM   #2
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
Some notes without looking into all the details; also i dont have a active wow subscription right now so it could be that i am not 100% right with what i am saying. i could read up some Blizzard Code but thats the hard way and i am a bit lazy to do it this way right now

I feel like it could be way way easier instead of hiding all this textures (ButtonFrameBottomTexture, BottomTexture etc) to hide their parent frame, if one exists ofc.

How to get a parent frame? frame:GetParent()
if its the same parent for all your textures just hide your parent, will be much easier todo

Hiding the parent frame will hide all childrens aswell. (Note: difference of frame:IsVisible() and frame:IsShown(). https://wow.gamepedia.com/API_Region_IsShown )

Also I couldnt figure out how to call my number table for "SetupHooks" so I had to put the individual frame number. Maybe there is a way to fix that.
two ways of accessing frames:
1. accesing it via the global Variable. for example: ChatFrame1
2. accessing it in the global table _G. for example _G["ChatFrame1"]. this way also allows you to do all kinds of string manipulation or use a string variable inside the [] .
So in your case the second way would be the prefered one.

Also you need to look up the differnce between global variables and local ones. DHBT is a global variable in your code which means this variable could be accessed and mofified from every other addon by typing _G["DBHT"] or just DHBT = "haha, i have just changed your variable"
If a variable should only exist in a single file define it like this at the beginning of your file: local DHBT = "whatever" if it should only exist inside a function and not even be visible inside the whole file define it the same way but inside the function


i guess thats all i have to say for now. If there is anything else let me know
  Reply With Quote
08-16-19, 04:02 PM   #3
ChandlerJoseph
A Fallenroot Satyr
Join Date: Aug 2019
Posts: 20
I will try a few of these things and get back to you. I am a little overwhelmed with this one. One quick question though. Some frames in WoW have a "." in them but that seems to cause lua errors. I read if you use a "%" in front it fixes that problem. Is that right?
  Reply With Quote
08-16-19, 06:58 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
http://lua-users.org/wiki/TablesTutorial
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-19-19, 06:11 PM   #5
ChandlerJoseph
A Fallenroot Satyr
Join Date: Aug 2019
Posts: 20
Im struggling a lot with this last addon im creating, would someone be willing to write up a addon that hides all the chat except the FontStringContainer unless your cursor is over top and add a "C_Timer.NewTimer(.5, XXX)" delay for when it hides
  Reply With Quote
08-20-19, 11:38 AM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Have a look at Chicchai
https://www.wowinterface.com/downloa...-Chicchai.html
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Chat Code Help

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