Hey guys, having an issue with a custom trigger with regard to it always returning false or nil. The end goal is to have the weakaura trigger when someone wispers me a specific phrase that I have set in my custom options and return false if I have a certain buff active on the player (hide itself and call Untrigger so I can clear my arrays)
I have two events this trigger is listening to: UNIT_AURA and CHAT_MSG_WHISPER. The proper code runs when the events are called, and returns if the conditions are met e.g. the buff I look for in UNIT_AURA is active on the player, return false and run the Untrigger() or if the whisper message was equal to the static trigger I've set in custom options e.g. "Hello!", return true and run the Trigger1 IsActive custom condition code. My question is, if the code of the trigger doesn't return anything e.g. the buff wasn't found on the player, will the trigger return false or nil even if I haven't stated so? This is what seems to be happening. My aura will trigger on the whisper, but instantly untrigger from the UNIT_AURA event
https://i.imgur.com/6byIK41.png
#Custom Trigger always returning false
22 messages · Page 1 of 1 (latest)
please do not send pictures of code. send the aura on wago.
you are trying to save something there in the config, you cant do that
the untrigger box doesn't work how you think it does
it doesn't run when you return false, it runs on the specified events
no
you cant do that in retail either. config is read only.
your custom code in conditions isnt needed either from taking a quick glance
Not sure what you mean by that - Untrigger is being called when the function ends after UNIT_AURA is called for example?
untrigger runs on the same event the trigger does
and currently it is returning true on every unit_aura event
ohhh, so basically I need to move my unit_aura block of code to untrigger and return true if the buff is found
from what I understand
technically yes but ideally you would just use SPELL_AURA_APPLIED/SPELL_AURA_REMOVED and store if the buff is currently applied to you or not and then checking what that status is when you get a whisper
unit_aura fires way too often
Didn't know those existed... THANKS! Its working perfectly
Btw, I've been using custom options arrays to get and set strings and integers for a while now. I have several WAs including this one that never has any issues doing so. The api should throw an exception if its read-only right? I've never seen one, so I assumed it had a setter
even this aura I linked is adding players to a list that wsp me and updates them as more whispers come in (up to 3)
No error is thrown by trying to write to the config table. It just won't stick