WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   macro behaviour dependent from location (http://www.wowinterface.com/forums/showthread.php?t=42339)

whoarrior 01-11-12 05:34 AM

macro behaviour dependent from location
 
Hi guys,

i'm looking for a macro which does different things depending on if i'm in the arena or not.

e.g.
inside the arena -> dispel magic
anywhere else -> pom
Code:

/cast [@arena1,noexists] Prayer of Mending
/stopmacro [@arena1,noexists]
/cast [mod,@player][@party1,nodead][] Dispel Magic

Any ideas, or do i need an addon which switchs macros when entering/leaving arenas?

(:

Phanx 01-11-12 04:37 PM

Since you want the macro to cast a spell (rather than perform some other action that does not take a target from the macro) you cannot use the @unit conditional unless you only want to cast Dispel Magic on the arena1 unit. If you simply want the button to become a normal Dispel Magic button inside arenas, you would need to use an addon that changed the macro when you entered an arena.

Phanx 01-11-12 07:08 PM

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)


whoarrior 01-12-12 04:51 AM

Looks great, i will try it at home. Thank you!

(:


All times are GMT -6. The time now is 12:30 AM.

vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC