View Single Post
Unread 01-11-12, 07:08 PM   #3
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,267
Code:
-- This needs to match your macro's name:
local macroName = "MacroNameHere"

-- Edit these as desired:
local arenaMacro = "/cast [mod, @player] [@party1, nodead] [] Dispel Magic"
local otherMacro = "/cast Prayer of Mending"

-- Don't edit anything below here. -------------------------------------

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function()
	local macroID = GetMacroIndexByName( "NAME_HERE" )
	if macroID then
		local _, instanceType = IsInInstance()
		local macroText
		if instanceType == "arena" then
			macroText = arenaMacro
		else
			macroText = otherMacro
		end
		EditMacro(macroID, macroName, "INV_Misc_QuestionMark", macroText, 1, 1)
		DEFAULT_CHAT_FRAME:AddMessage(string.format("%s macro updated.", macroName))
	else
		DEFAULT_CHAT_FRAME:AddMessage(string.format("%s macro not found!", macroName))
	end
end)

Last edited by Phanx : 01-16-12 at 05:18 AM.
Phanx is offline   Reply With Quote