Thread Tools Display Modes
02-06-14, 06:53 PM   #21
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
I want to be able to step through my code and put breakpoints, etc. :-)
  Reply With Quote
02-06-14, 07:54 PM   #22
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Or... http://www.wowinterface.com/download...66-WowLua.html
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-08-14, 05:36 PM   #23
urbley
A Deviate Faerie Dragon
Join Date: Feb 2014
Posts: 10
Ok so I have a crude little frame with all my buttons on it and I have created a set of hidden buttons on the UI with my macrotext targetting code for each permutation of Nazgrim's adds. I can just type /click myButton and it's all good but I've set the frame buttons to use those buttons and nothing seems to happen :/ Any ideas? I'll give an example.

Lua Code:
  1. local targetSAButton = CreateFrame("Button", "targetSA", UIParent, "SecureActionButtonTemplate")
  2.     targetSAButton:Hide()
  3.     targetSAButton:SetAttribute("type", "macro")
  4.     targetSAButton:SetAttribute("macrotext", [[
  5. /cleartarget
  6. /tar [@Kor'kron Assassin, nodead] Kor'kron Assassin
  7. /script SetRaidTarget('target', 7)
  8. /cleartarget
  9. /tar [@Kor'kron Warshaman, nodead] Kor'kron Warshaman
  10. /script SetRaidTarget('target', 8)
  11. /rw Warshaman + Assassin]])
  12.  
  13. local saButton = CreateFrame("button", "NazAddsFrameSAButton", NazAddsFrame, "UIPanelButtonTemplate")
  14.     saButton:SetHeight(20)
  15.     saButton:SetWidth(40)
  16.     saButton:SetPoint("TOPLEFT", NazAddsFrame, "TOPLEFT", 12, -12)
  17.     saButton:SetText("S+A")
  18.     saButton:SetAttribute("type", "macro")
  19.     saButton:SetAttribute("macrotext", "/click targetSA")

I hope you're all having a more exciting Saturday night that I am

Last edited by urbley : 02-08-14 at 05:40 PM. Reason: LOL
  Reply With Quote
02-08-14, 09:20 PM   #24
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You're still using slightly wrong macro commands. This is not valid:

Code:
/tar [@Kor'kron Assassin, nodead] Kor'kron Assassin
You cannot use a mob name with the @targetUnit conditional. I assume your goal is to avoid setting the icon on a dead unit, in which case you should go back and re-read the last code I posted in this thread, and copy it.

Not only will it only set icons on live targets, but it also uses /targetexact instead of /tar (which is short for just plain old /target) so if no target by the specified name is available, it won't target the next closest match (which in this case might be a Kor'kron War Shaman instead of a Kor'kron Assassin). Since you're using macrotext attributes, and not traditional buttons, you are not limited to 255 characters and do not need to use less-than-optimal commands just because they're shorter.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-08-14, 11:03 PM   #25
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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
]])

Last edited by Vrul : 02-08-14 at 11:06 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Target NPC


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