#Dynamic tracking of text changes in a macro

44 messages · Page 1 of 1 (latest)

neon fog
#

Hello again everyone. Made some progress in solving my problem.
To change the text of a Macro (let's call it ActionMacro), I use another Macro (let's call it SwitchMacro).
My idea was this:
Create a trigger that will fire every time I click on SwitchMacro. I tried to do this using ScanEvents and it works, although only 1 time. That is, when I click on the SwitchMacro my UI changes according to the changes in the ActionMacro. Everything is fine, but when I click on SwitchMacro again, the UI does not update. At the same time, the text in ActionMacro has definitely changed. Those. I conclude that the second time, the trigger from ScanEvents does not work. It’s worth adding that the UI is updated if I manually log into WA.

What should I do? How can I make the trigger fire every time I click on a macro?

P.S
I understand that my method is not ideal, and most likely there is another way to dynamically track changes in the macro text, but I could not find it

errant ocean
#

What are you trying to do? Have a button that will change what WAs are shown when you press it?

neon fog
#

I have M6 addon, which allows me to make more complex macros. It contains three macros:

  1. AttackTank1
    #showtooltip Tricks of the Trade
    /cast [@tank1,help] Tricks of the Trade
  2. AttackTank2
    #showtooltip Tricks of the Trade
    /cast [@tank2,help] Tricks of the Trade
    3)TrickSwitchM6
    /script macroIndex = GetMacroIndexByName("_M6+s01")
    /script body = GetMacroBody(macroIndex)
    /script if string.find(body, "/click M6Prime s01") then body = "#showtooltip\n#m6\n/click M6Prime s03" else body = "#showtooltip\n#m6\n/click M6Prime s01" end
    /script EditMacro(macroIndex, nil, nil, body)
    /script WeakAuras.ScanEvents("FORCE_UPDATE")

This addon also generates buttons for calling these macros in the standard wow macro interface:
"_M6+s01"
#showtooltip
#m6
/click M6Prime s01

  • a macro that triggers the M6 ​​Macro AttackTank1.

If I change bodytext in _M6+s01 to
#showtooltip
#m6
/click M6Prime s03
then it will start calling the M6 AttackTank2 macro

I need this so that when I click on the macro “TrickSwitchM6” I can change the bodytext to “_M6+s01”.
I need to track this event in WA

errant ocean
#

Well WeakAuras.ScanEvents() is the right thing to use here. I would use a more unique event name than FORCE_UPDATE though.

neon fog
#

This is my WA that I was able to do at this stage.
It performs several functions

  1. It displays information on the ui about what tanks I have in my raid/group and changes the color of the text depending on the class of the tank
  2. It adds the string “TrickTarget” to the text “Tank1” or “Tank2”, depending on what text is contained in the macro “_M6+s01”

The first function works perfectly - I added a trigger for what if someone changes their role, so the information on the UI is dynamically updated.

The second function works fine, but does not update dynamically when I click on the TrickSwitchM6 macro. It changes only once, and then I need to manually log into WA for the information to be updated

neon fog
errant ocean
#

Can you put your aura on wago

neon fog
#

yes, sorry, I forgot

errant ocean
#

the bot usually uploads it for you if you're not in #1020038887910936647

#

So the outcome you want is when you press the maco that has scanevents it swaps something in your auras

neon fog
#

yeah

errant ocean
#

and it should toggle

neon fog
#

if string.find(macroText, "/click M6Prime s01") then
-- Add "TrickTarget" label before "Tank1"
if i == 1 then
tankLabel = ("|cffff0000TrickTarget|r Tank%d"):format(i)
end
elseif string.find(macroText, "/click M6Prime s03") then
-- Add "TrickTarget" label before "Tank2"
if i == 2 then
tankLabel = ("|cffff0000TrickTarget|r Tank%d"):format(i)
end
end

errant ocean
#

just post the wago link it'll be more helpful

neon fog
#

Works?

errant ocean
#

ya

neon fog
#

Well, now my problem is that the trigger only fires 1 time when pressed switch macro. If I do it again, the ui does not change in any way and you have to manually go into WA for the UI to update the information. By the way, after I manually enter and exit WA, I can again click on the macro once for the trigger to work.

errant ocean
#

Trigger3 is what's responding to your macro press yea? all it does is return true

neon fog
#

Yes, the macro tries to call this trigger and it works 1 time)

errant ocean
#

If you have no untrigger condition for it then when you call scanevents again it will do nothing

#

the trigger is already active

neon fog
#

Please tell me how I should change this trigger then?

errant ocean
#

make the trigger timed with 0.1sec or add an untrigger condition

neon fog
#

Ok thanks, I will try it)

errant ocean
#

but doing nothing with your trigger won't change the state of your weakauras

#

unless you just want them to show/hide

neon fog
#

I thought that it was enough for me to simply call this trigger, since I have activation for any trigger

errant ocean
#

yeah it you just want your auras to show up when you press the macro then thats fine

#

but you wouldn't want to use a timed trigger in that situation

#

assuming you want to keep them visible until you press it again

neon fog
#

Well, that is, I thought it worked like this:
If ANY of the triggers fires, then the custom code in display runs

errant ocean
#

yeah it would do that

neon fog
#

I will try to create untrigger condition

#

Thanks you

errant ocean
#

if your other triggers are keeping it visible then a 0.1sec timeout on trigger 3 should work

neon fog
#

So I need to create a function with timeout instead of "function()
return true
end"?

errant ocean
#

no just change the trigger to be timed and set a time

#

I think Event triggers default to timed

#

but if you dont set a time limit then the time is inf

neon fog
#

Great, everything worked!

#

Thank you very much, I have been dealing with this problem for a very long time

errant ocean
#

Main thing to remember is that trigger state doesn't update unless the trigger changes from true->false or false->true.

true->true will not update the trigger.

neon fog
#

Got it, now I'll know)