WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Tooltip and SetAlpha (https://www.wowinterface.com/forums/showthread.php?t=57851)

Kindosar 02-28-20 05:05 PM

Tooltip and SetAlpha
 
Hello, I'm very new to creating scripts in an addon format. I'm not new to simply writing them. I created an account because I cannot find this information online, so I'm hoping the pros here can help.

I'm trying to write a script that sets the opacity of the tooltip to be 0.5. When I test it (while mousing over something and typing the script directly into the chat window), it works; however, as soon as I move away from the object I'm mousing over, it returns to be 100% opacity. Here is how I write the script in game:

GameTooltip:SetAlpha(0.5)

If I put this into my addon, it changes nothing, however when I put GameTooltip:SetScale(0.8) into the addon, it permanently changes the size of the tooltip without issue.

Can you explain why this is happening and what I can do to fix this issue?

Thank you in advance.:banana:

Fizzlemizz 02-28-20 05:30 PM

Various attributes of the GameTooltip can change each time it is shown although the scale is unlikely to be one of them.

Try hooking it's OnShow script

Code:

GameTooltip:HookScript("OnShow", function(self) self:SetAlpha(0.5) end)
It might depend on what other addons effecting tooltips you have installed.

Kindosar 02-28-20 08:14 PM

So this seems to work sometimes, but not all the time. It's strange how its reacting, then again, I'm very new to this...

I'll start by asking the following and hope that the other issues just solve themselves along the way:

Using the above script works great, but seems to only work perfectly on spells and abilities on my action bars.

Question: What can I do to make it work for other things such as items in my bags, equipment on my character screen, and spells in my spell book?

Other Observations: I initially tried to fix some other issues effecting the tooltip using a block of code to turn off the fading of the tooltip. When the tooltip fades, it goes to 100% opacity until it fades. Which seems to be causing other issues with it choosing if something is going to be at 50% opacity when you mouse over it. However, the block of code didn't fix all the issues, so I'm attempting to check if it could be something else by fixing the above question of items in bags, equipment on the character ui, and the spell in the book.

:banana::banana::banana:

Terenna 02-28-20 11:33 PM

What about securehooking GameTooltip_SetBackdropStyle ?


All times are GMT -6. The time now is 01:38 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI