/target varname

Is that possible to use a var name after a /target command in a macro? Example:

/run mobname = "Hermit Crab";
/target mobname

In this example, target is searching for a mob called “mobname” instead of Hermit Crab. I’m almost sure I can’t use target with a var, but to make sure I’d thought about asking here.

1 Like

What is the ultimate intention of the macro? If this doesn’t work, someone might know how to actually do whatever it is you want.

It’s because I have a target macro and every time I’m farming mobs, I need to open this macro, edit the target name, save, etc… I know, not a big deal, but by using a var, I could do a /run mobname = "Hermit Crab" on the chat and the macro would be adjusted for the kind of mob I need.

2 Likes

Could probably do it with an addon that creates a dedicated button.

Something like (copy/paste into the website addon.bool.no to create/download the addon):

local f = CreateFrame("Button", "FizzleTargetMob", UIParent, "InsecureActionButtonTemplate, UIPanelButtonTemplate")
f:SetText("Hermit Crab")
f:SetAttribute("type", "macro")
f:SetAttribute("macrotext", "/target Hermit Crab")
f:SetPoint("LEFT", 10, 0)
f:SetSize(100, 27)

-- Slash command to change mob. Use /ftm mob name
_G["SLASH_FizzleTargetMob1"] = "/ftm"
SlashCmdList["FizzleTargetMob"] = function(msg)
	f:SetText(msg)
	f:SetAttribute("macrotext", "/target ".. msg)
end

Use: /ftm mob name to change targets. You won’t be able to change targets in combat. Adjust bits as required.

2 Likes

I find it very strange that both of the two most highly respected posters on this forum: Fizzlemizz and Elevenbane, were unable to correctly address this simple maco request.

This is the macro you are looking for, simply name your macro “target” and paste the following code:

/run if SecureCmdOptionParse("[mod:ctrl]") then local t,n=UnitName("target"),"target" local b=GetMacroBody(n) EditMacro(n,n,nil,strsub(b,1,strfind(b,"\n")).."\n/target "..t) end
/target x

Hold Ctrl and use the macro to set the target’s name, after that every subsequent use will target that same name. It will not work in combat.

There is a greater issue here that appears to be that this macro forum is being deliberately sabotaged in an attempt to hide or restrict certain functionality.

This is not a difficult macro. It does not require an addon. Both Fizzlemizz and Elevenbane were more than capable of posting this solution. Why didn’t they?

If anyone has any idea why these “respected” forum members are choosing to stonewall certain macro requests, please share. I would greatly appreciate it.

Thank you.

2 Likes

lol we’re not omniscient and there’s certainly no conspiracy to sabotage these forums, which are community driven. Fizzle and I are just regulars who enjoy helping people and have some knowledge and expertise to share, nothing more.

1 Like

SShhh, I’ve always wanted to be part of a conspiracy but been too lazy. This = cake+eats = happy days :sunglasses:.

3 Likes

There should be a lot more cool, fun, interesting, and useful macros being discussed in a game that has solid roots in scripting culture

There aren’t, and I’m just trying to understand why (and maybe how to fix it).

I just asked why you couldn’t share a proper solution.

Calling it a conspiracy is actually a compliment because it’s obvious you have the advanced knowledge to answer these questions (and much more).

1 Like

I wish.

First, I’m still dirty at Blizzard for ‘cough’ loosing WoWI’s list of addon authors for Classic Beta invites (including mine). There’s stuff I wanted to get done before launch tomorrow that would have allowed me to just play without having to constantly check for bug reports. So not happy. Don’t miss-represent verbose-poster with “insider”.

Seriously, everything I post is done with the expectation someone else can/will know and show better. This thread is an example of that and, assuming your code works as intended (which I assume it does), it should have ended there.

To be cheeky, “take the win!”

Edit:

The idea that there is a “proper solution” to any given problem, especially where computer code is concerned, is more of a “conspiracy” than anything else in this thread.

If you see a problem, you fix it by coming here every day, day after day, and posting your best solutions to peoples problems like…

1 Like

Thanks a lot for the solutions, guys! You are awesome!

How do we target mobs that have similar name like “voidscale hydra” or “siltridge hydra” or Stonemaw Hydra" ?

I mean is there a way to target the closest of these tthree in a macro?
or is there a way to be able to target any one who is the closest one and that have in its name “Hydra”?

I dont knwo how LUA works but I guess from the pgramming that I know in other languages that it should be possible…

and also if I would like to learn more about LUA and be able to program my self where do you suggest me to start? and with wich tool?

Thank you very much !

1 Like

Not in combat, no. You can chain a bunch of /tar name commands together and it’ll stop at the last one but there isn’t a way to do it by proximity, they killed that back in Wrath.