World-of-warcraft – World of Warcraft scripting, cast at npc via saved variable name

world of warcraft

I already have a way of storing what I want to attack in a variable, and can verify that's successful. All I need to know is how to properly cast at something with the name I've stored in said variable. Example

Var1 = "Jimmy"
/cast [@Var1] Heal

The above obviously doesn't work, but I hope it shows what I'm trying to do.

No, I can't just target the thing I'm casting on.
No, I can't just use focus, as I need focus for something else.
The point is to maintain my current target and focus, and still cast on something else without something like a mouseover macro.

Best Answer

Casting is a protected function (as is also targeting, and a number of other critical functions) and can't be accessed by tainted code (i.e. lua scripts/addons).

This limitation was introduced way back (patch 2.0) when mods like Decursive trivialized game content by basically making you press one button repeatedly and playing the game for you.

For more info read up on "Secure Execution and Tainting"

The most you can do with casting is only via direct (untainted) use of /cast and /castsequence commands. More info on that you can find in the 'Macro options' section of the following article: http://www.wowwiki.com/Making_a_macro