As Phanx pointed out again, you can't target like you are trying. You are also creating a button that does nothing but /click another button? I think this does what you want (or close):
Code:
local marker, message = 8
SLASH_GeneralNazgrimMarker1 = "/gnm"
SlashCmdList.GeneralNazgrimMarker = function(command)
if command == "reset" then
SetRaidTarget("player", 8)
SetRaidTarget("player", 7)
SetRaidTarget("player", 0)
marker, message = 8, nil
end
if UnitExists("target") and not UnitIsDead("target") then
SetRaidTarget("target", marker)
marker = marker - 1
local name = UnitName("target"):match("%a+$")
if message then
message = message .. " + " .. name
else
message = name
end
end
if command == "warn" then
if message and IsInGroup() then
SendChatMessage(message, "RAID_WARNING")
end
end
end
local button = CreateFrame("Button", "GeneralNazgrimMarker", UIParent, "SecureActionButtonTemplate,UIPanelButtonTemplate")
button:SetSize(40, 20)
button:SetPoint("CENTER")
button:SetText("GNM")
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", [[
/cleartarget
/targetexact Kor'kron Warshaman
/gnm reset
/cleartarget
/targetexact Kor'kron Arcweaver
/gnm
/cleartarget
/targetexact Kor'kron Assassin
/gnm
/cleartarget
/targetexact Kor'kron Ironblade
/gnm warn
/cleartarget
/targetexact Kor'kron Warshaman
/targetexact [dead][noexists] Kor'kron Arcweaver
/targetexact [dead][noexists] Kor'kron Assassin
/targetexact [dead][noexists] Kor'kron Ironblade
/targetexact [dead][noexists] General Nazgrim
]])
If you remove the raid warning spam it would allow you to spam the button when expecting the adds and when the first is about to die (to auto target):
Code:
local marker = 8
SLASH_GeneralNazgrimMarker1 = "/gnm"
SlashCmdList.GeneralNazgrimMarker = function(command)
if command == "reset" then
SetRaidTarget("player", 8)
SetRaidTarget("player", 7)
SetRaidTarget("player", 0)
marker = 8
end
if UnitExists("target") and not UnitIsDead("target") then
SetRaidTarget("target", marker)
marker = marker - 1
end
end
local button = CreateFrame("Button", "GeneralNazgrimMarker", UIParent, "SecureActionButtonTemplate,UIPanelButtonTemplate")
button:SetSize(40, 20)
button:SetPoint("CENTER")
button:SetText("GNM")
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", [[
/cleartarget
/targetexact Kor'kron Warshaman
/gnm reset
/cleartarget
/targetexact Kor'kron Arcweaver
/gnm
/cleartarget
/targetexact Kor'kron Assassin
/gnm
/cleartarget
/targetexact Kor'kron Ironblade
/gnm
/cleartarget
/targetexact Kor'kron Warshaman
/targetexact [dead][noexists] Kor'kron Arcweaver
/targetexact [dead][noexists] Kor'kron Assassin
/targetexact [dead][noexists] Kor'kron Ironblade
/targetexact [dead][noexists] General Nazgrim
]])
And honestly all you really need is something spammable for targeting/marking the most important add:
Code:
local button = CreateFrame("Button", "GeneralNazgrimMarker", UIParent, "SecureActionButtonTemplate,UIPanelButtonTemplate")
button:SetSize(40, 20)
button:SetPoint("CENTER")
button:SetText("GNM")
button:SetAttribute("type", "macro")
button:SetAttribute("macrotext", [[
/targetmarker [@player] 8
/targetmarker [@player] 0
/cleartarget
/targetexact Kor'kron Warshaman
/targetexact [dead][noexists] Kor'kron Arcweaver
/targetexact [dead][noexists] Kor'kron Assassin
/targetexact [dead][noexists] Kor'kron Ironblade
/targetmarker [exists,nodead] 8
/targetexact [dead][noexists] General Nazgrim
]])