This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Classic Theme
Thottbot Theme
Target Mount
Post Reply
Return to board index
Post by
Cheest
I was looking through the script commands for macros, and it seemed possible to do what I want.
I want a macro that gets the targeted players mount, and if I have the same mount, will cast it.
I don't know the format of lua, so if someone with better knowledge want to solve this, it'd be appreciated.
Post by
997836
This post was from a user who has deleted their account.
Post by
Ketho
Can you try this script?
/run local t,m={},"MOUNT"for i=1,GetNumCompanions(m)do t=i end for i=1,32 do local b=select(11,UnitBuff("target",i))if tthen CallCompanion(m,t)break end end
Post by
TheReal
Sorry, just going to make it easier to read:
/run local t,m={},"MOUNT"
for i=1,GetNumCompanions(m) do
t=i
end
for i=1,32 do
local b=select(11,UnitBuff("target",i))
if t then
CallCompanion(m,t)
break
end
end
Looks good Ketho. Pretty much the same way I was going to work it but got busy.
One thing I don't understand though is the purpose of "MOUNT" in the first line.
Edit: derp. I get it now. That whole declaring variables in sequence like that always gets me.
Post by
Cheest
This worked perfectly, any way to make it also work with companions?
Post by
Ketho
Can you try this? You need to have the companion targeted though
/run local t,c={},"CRITTER"for i=1,GetNumCompanions(c)do t=i end local id=tonumber(strsub(UnitGUID("target"),7,10),16)if tthen CallCompanion(c,t)end
* If you don't have anything currently targeted it will give an error
Post by
Cheest
That also worked :D Thank you.
Post by
Cheest
Ketho, anyway I can make the macro target the nearest mounted player and attempt to cast it, and if that fails it casts another mount? Also, could it work with titles? I'm having so much fun just copying people.
Post by
Ketho
Ketho, anyway I can make the macro target the nearest
mounted
player and attempt to cast it, and if that fails it casts another mount?
You can target nearest (friendly/enemy) player, but afaik it's not possible to target someone based on if they're mounted or not
The "
cast another mount
" part sounds vague. You want
1)
a "random" mount or
2)
a specific other mount? Either way, there isn't much space left in the macro
:(
You could maybe
chain macros
to get more space to
play
around with it, or alternatively get an
addon
/targetfriendplayer
/run local t,m,n={},"MOUNT",GetNumCompanions for i=1,n(m)do t=i end for i=1,32 do local b=select(11,UnitBuff("target",i))if tthen CallCompanion(m,t)return end end CallCompanion(m,random(n(m)))
Also, could it work with titles? I'm having so much fun just copying people.
Can you try this? This is a bit troublesome, since you need have the target
mouseovered
in order to check the GameTooltip
/run for i=1,GetNumTitles()do if IsTitleKnown(i)==1 and strfind(GameTooltipTextLeft1:GetText()or"",GetTitleName(i))then SetCurrentTitle(i)break end end* untested/drycoded
Post by
Cheest
Message: :1: bad argument #3 to 'strfind' (number expected, got boolean)
Time: 06/15/12 16:32:46
Count: 2
Stack: : in function `strfind'
:1: in main chunk
: in function `RunScript'
Interface\FrameXML\ChatFrame.lua:2118: in function `?'
Interface\FrameXML\ChatFrame.lua:4293: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:3992: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:2704: in function <Interface\FrameXML\ChatFrame.lua:2697>
: ?
: in function `UseAction'
Interface\FrameXML\SecureTemplates.lua:275: in function `handler'
Interface\FrameXML\SecureTemplates.lua:561: in function `SecureActionButton_OnClick'
Interface\FrameXML\ActionButton.lua:28: in function `ActionButtonDown'
:2: in function <:1>
Locals: (*temporary) = "Guärdian the Patient"
(*temporary) = "Elder "
(*temporary) = true
(*temporary) = "number expected, got boolean"
^Error I received. The problem with /targetfriendplayer is it targets the closest, when I press it again it just still targets the closest. I would like the ability for it to target players until it casts. Maybe an addon would be more simple :D I appreciate all your efforts in this thread btw.
Post by
Ketho
bad argument #3 to 'strfind' (number expected, got boolean)
My bad, didn't know GetTitleName returned 2 values. Can you try this, Cheest?
/run for i=1,GetNumTitles()do if IsTitleKnown(i)==1 and strfind(GameTooltipTextLeft1:GetText()or"",(GetTitleName(i)))then SetCurrentTitle(i)break end end
The problem with /targetfriendplayer is it targets the closest, when I press it again it just still targets the closest. I just qant it to continue targeting until it casts.
Do you mean that /targetfriendplayer only keeps targeting the closest player?
It's almost essentially the same thing as Ctrl-Tab though
And didn't you first say you want it to otherwise "cast another mount"?
Anyway, if you want it to continue tabbing until it casts, you could just put /targetfriendplayer before the original macro
/targetfriendplayer
/run local t,m={},"MOUNT"for i=1,GetNumCompanions(m)do t=i end for i=1,32 do local b=select(11,UnitBuff("target",i))if tthen CallCompanion(m,t)break end end
Post by
TheReal
Sounds like Ketho is well on his way to writing another add-on here. I'd name it CopyCat.
:)
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.