Quantcast
Script that can execute a macro upon changing (PvP) talents - WoWInterface
Thread Tools Display Modes
10-16-20, 03:03 PM   #1
Cretch21
A Murloc Raider
Join Date: Oct 2020
Posts: 6
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!
  Reply With Quote
10-16-20, 08:28 PM   #2
DahkCeles
An Aku'mai Servant
 
DahkCeles's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 32
I'm sure there's a much more elegant solution, but I came up with this quickly:

Code:
/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)
  Reply With Quote
10-16-20, 09:12 PM   #3
Cretch21
A Murloc Raider
Join Date: Oct 2020
Posts: 6
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:

#showtooltip
/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).
  Reply With Quote
10-17-20, 09:48 AM   #4
DahkCeles
An Aku'mai Servant
 
DahkCeles's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2020
Posts: 32
https://wow.gamepedia.com/API_EditMacro

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 https://addon.bool.no/


Lua Code:
  1. local macro1 = [=[#showtooltip
  2. /cast Thoughtsteal]=]
  3.  
  4. local macro2 = [=[#showtooltip
  5. /cast Shadowfiend]=]
  6.  
  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)
  Reply With Quote
10-17-20, 12:18 PM   #5
Cretch21
A Murloc Raider
Join Date: Oct 2020
Posts: 6
You are the motherf**king MVP thank you!!!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Script that can execute a macro upon changing (PvP) talents

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off