View Single Post
08-22-14, 11:41 AM   #1
Sylen
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 50
Detecting the Group Position of an Arena Oppenent

Hey, i got the following macro:
Code:
/focus [@arena1]
Due to macro space problems i usually have to edit the macro for the case that the enemy healer is arena2 or arena3 (etc.).
What i thought about doing is, writing a script which detects the positon of the healer in the enemy arena team and then edits my macro automatically for me. I am aware that this is only working outside of combat, which is fine, because i just want it to work during the preparation time. Also i dont mind if i have to fire the script manually while waiting in the prep zone.
Because Blizzard already implemented the detection of the enemy specs during the prep phase i thought i could use this to filter the enemy team.
The idea is to listen for the event that fires when information about arena opponents are available. Then use it to get information about enemy specializations. In the end filter the information to get the postion of the healer in the enemy team.
Code:
local f=CreateFrame("Frame")
	f:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS")
	
f:SetScript("OnEvent",function(self,event,...)	
	local numOpps=GetNumArenaOpponentSpecs()
	for i=1,numOpps do		
		local specID=GetArenaOpponentSpec(i)		
		local _,spec,_,_,_,role,_=GetSpecializationInfoByID(specID)			
		if specID>0 and role="HEALER" then	
			--/run index=GetMacroIndexByName("name"); print(i) use this to get macroIndex 
			EditMarco(index,nil,nil,"/focus [@arena"..i.."]",1,1)			
		end		
	end
end)
Links to the functions/events i used in my code:

Last edited by Sylen : 08-22-14 at 11:42 AM. Reason: Changed thread title to state the topic more clearly
  Reply With Quote