Issue with Cooldownannounce-Script
Hey @all!
I use for DuffedUI v8 the following script to announce cooldowns like Icebound Fortitude, Shield Wall and so on. Announcescript: Lua Code:
Delayfunction: Lua Code:
The problem is that when I log in and use a skill that is in the table, nothing happens. Do I have a reload of the entire interface made, the script works and I get the desired output, such as Quote:
Quote:
Currently, I honestly do not and how I could fix the problem.Thank you once for all proposals or suggestions to the problem. greetz liquid |
Just a quick guess: does using PLAYER_LOGIN instead of PLAYER_ENTERING_WORLD fix your problem?
Don't ask me on details (can't remember exactly :)), but the events on reloading the UI are not 100% the same as on login. [e] Doh. Nevermind. I'm just realizing that you're registering PLAYER_ENTERING_WORLD but don't actually use it. |
I would say this is about
Lua Code:
C["duffed"].spellannounce is there on reload but not on login. Move this into the OnEvent function and trigger it on PLAYER_ENTERING_WORLD: Lua Code:
Do the same with this part: Lua Code:
|
D.Delay is a global function for the entire UI so I in which the option can not connect with. I use it for different elements. And when I put the query together with Spell-Table in the OnEvent function, I got the same result.
After logging => no function After the reload => Works |
Lua Code:
I don't know why it does work after reloading the UI (would say it shouldn't :)) ... but this could be a hint to your problem. |
After moving these two values into the OnEvent-function it works. I had replace GUID and Name in the function with UnitGUID("player") and UnitName("player") and it works. Code looks now posted below and ist works.
Lua Code:
Thanks Duugu, you have point me in the correct direction with your help :) |
Yeah, name and/or GUID not being available seems probable. Much data gets downloaded as you login and might not need to be downloaded again when you reload the UI.
Another way to check if the unit is the player is this: Code:
CombatLog_Object_IsA(flags, COMBATLOG_FILTER_ME) |
Yes I've noticed with the script and after that is now fixed now it's really good to me. Was the very last thing that has annoyed me personally, before the actual release ^^
|
UnitName will return a valid value for the player unit immediately. However, UnitGUID won't return anything useful until PLAYER_LOGIN. Rather than calling these functions repeatedly in a combat log handler (which runs extremely frequently, and therefore adding 2 function calls there is extremely inefficient) you should register for PLAYER_LOGIN and initialize the variables there.
Also, I don't understand why you're checking the destination name instead of the destination GUID? Just check the GUID like you're doing with the source... Code:
-- at the top: 1. You only register for PLAYER_LOGIN at first. 2. When it fires, store the player's GUID, register for CLEU, and replace the OnEvent handler with the CLEU handler. 3. In the CLEU handler, refer to the stored GUID instead of looking up the same value over and over millions of times per play session. |
All times are GMT -6. The time now is 10:30 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI