WoWInterface (
-   AddOn Search/Requests (
-   -   Script that can execute a macro upon changing (PvP) talents (

Cretch21 10-16-20 03:03 PM

Script that can execute a macro upon changing (PvP) talents
I have a macro that I would like to run every time I change a PvP Talent. Is that possible to do? Thanks guys!

DahkCeles 10-16-20 08:28 PM

I'm sure there's a much more elegant solution, but I came up with this quickly:


/run local f = CreateFrame("Frame") f:RegisterEvent("PLAYER_PVP_TALENT_UPDATE") f:SetScript("OnEvent", function() print("HelloWorld") end)

Or if you want to put it in an addon...

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_PVP_TALENT_UPDATE")
  3. f:SetScript("OnEvent", function()
  4.     print("HelloWorld")
  5. end)

Cretch21 10-16-20 09:12 PM

That's awesome! Do you think its possible to have that script activate a macro that's on my bars?

If it helps, this is the macro I'm running:

/run local G=GetSpellInfo SetMacroSpell(GetRunningMacro(), G"Thoughtsteal" or G"Shadowfiend")

I'm using it just for displaying the tooltip (to try and never see that blank "?" on my bars).

DahkCeles 10-17-20 09:48 AM

Before installing this script, create a macro called "myFavouriteMacro" and drag it to an action bar.

You can turn the script into an addon using

Lua Code:
  1. local macro1 = [=[#showtooltip
  2. /cast Thoughtsteal]=]
  4. local macro2 = [=[#showtooltip
  5. /cast Shadowfiend]=]
  7. local f = CreateFrame("Frame")
  8. f:RegisterEvent("PLAYER_PVP_TALENT_UPDATE")
  9. f:SetScript("OnEvent", function()
  10.   EditMacro("myFavouriteMacro", nil, nil, GetSpellInfo("Thoughtsteal") and macro1 or macro2)
  11. end)

Cretch21 10-17-20 12:18 PM

You are the motherf**king MVP thank you!!!

All times are GMT -6. The time now is 06:52 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI