Melee Shoot Macro

Melee Shoot Macro

by xanderbox » Thu Jan 14, 2016 7:41 pm

Is there an equivalent macro for the three shoot skills melee has. Once the new syntax is in the game you can have it check to see which type of ranged weapon is equipped and use the appropriate skill as below. Is this possible in vanilla?

/cast [equipped:gun] shoot gun
/cast [equipped:bow] shoot bow
/cast [equipped:crossbow] shoot crossbow
User avatar
xanderbox
Tester
 

Re: Melee Shoot Macro

by Roadblock » Thu Jan 14, 2016 10:55 pm

Ok, haha this was a nice challenge to fit in 255 chars :D .
Code: Select all
/script local _,_,i=strfind(GetInventoryItemLink("player",18),"\124Hitem:(%d+)");local _,_,_,_,_,p=GetItemInfo(i);local t={["Bows"]="Bow",["Guns"]="Gun",["Crossbows"]="Crossbow",["Thrown"]="Throw"};CastSpellByName((string.gsub(t[p],"^([^T])","Shoot %1")))

(255 chars)
Gist for easy copy paste: https://gist.github.com/Dridzt/c45e3c14 ... ro-vanilla
Last edited by Roadblock on Thu Jan 14, 2016 11:13 pm, edited 1 time in total.
Astaldo @ Nostalrius PvE (Alliance)
Addons I've posted on Forum
User avatar
Roadblock
Senior Sergeant
Senior Sergeant
 

Re: Melee Shoot Macro

by Roadblock » Thu Jan 14, 2016 11:03 pm

v2 with 7 chars to spare (248 chars instead of 255)
Code: Select all
/script local _,_,i=strfind(GetInventoryItemLink("player",18),"\124Hitem:(%d+)");local _,_,_,_,_,p=GetItemInfo(i);local t={};t.Bows="Bow";t.Guns="Gun";t.Crossbows="Crossbow";t.Thrown="Throw";CastSpellByName((string.gsub(t[p],"^([^T])","Shoot %1")))
Astaldo @ Nostalrius PvE (Alliance)
Addons I've posted on Forum
User avatar
Roadblock
Senior Sergeant
Senior Sergeant
 

Re: Melee Shoot Macro

by Roadblock » Thu Jan 14, 2016 11:09 pm

Last version 241 chars :P
Code: Select all
/script local _,_,i=strfind(GetInventoryItemLink("player",18),"\124Hitem:(%d+)")local _,_,_,_,_,p=GetItemInfo(i)local t={}t.Bows="Bow"t.Guns="Gun"t.Crossbows="Crossbow"t.Thrown="Throw"CastSpellByName((string.gsub(t[p],"^([^T])","Shoot %1")))


It should handle all 4 ranged skills btw, Gun, Bow, Crossbow and Thrown.
Astaldo @ Nostalrius PvE (Alliance)
Addons I've posted on Forum
User avatar
Roadblock
Senior Sergeant
Senior Sergeant
 

Re: Melee Shoot Macro

by Fuhrern » Sat Jan 16, 2016 12:24 pm

Thanks a lot for this macro, I've needed this one for a while!
Fuhrern
Sergeant
Sergeant
 


Return to Addons & macros