Call lua script from Macro?
Is possible to call a lua script from Macros?
I was search about it, and I saw that macros can't perform some actions, but lua scripts can. Via /run, because using this, seems that we can bypass the "default macro conditionals". Is there way to do that? Thanks. |
You can put a "/run" command in a macro. "/run" is just a slash command that executes whatever comes after it as raw Lua code, whereas "/cast" is a slash command that takes what comes after it and passes it to a pre-defined block of Lua code that casts the named spell, etc.
However, if there is something you cannot do in a "macro" (eg. "cast Spell A if it's off cooldown, otherwise Spell B" or "if the unit's health is below 20% cast X, otherwise cast Y") then you cannot do that from a "Lua script" either. Most "macro commands" -- like /cast and /use -- exist because Blizzard does not want your macro or addon making decisions about which spells to cast. They want you, the player, to have to pay attention and use a little brain power to go "oh, this unit's health is below 20%, I should use my execute ability" -- not be able to mash a single button and have some lines of code look at all the conditions and make the decision for you. |
thanks phanx...
i thought if theres possible to make it in lua, would be possible to make a macro with it... i saw some examples with health conditional (didn't try) so, is it possible to make something like: cast spell x; cast y and keep repeating y spell for x seconds tried with reset but i think it doesn't work as i expected |
/castsequence reset=20 SpellA, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB, SpellB
... is about the closest you can get. It sounds like you're trying to make a button that casts X if it's off cooldown, or Y otherwise, and that is exactly the kind of thing Blizzard does not want an addon/macro to be able to do. They want you to pay attention to your cooldowns, pay attention to your target's health, and make your own decisions in realtime about what abilities to use. Personally I just use a modifier key for combining a cooldown ability with another ability. It's really no more effort than having a manual reset on the castsequence, and gives me much better control over when the cooldown ability gets used. /cast [mod:alt] SpellA; SpellB Edit: I'm not sure what kind of addon you're talking about with a "health conditional" but I can tell you right now that it's not automatically casting Spell A or Spell B based on the target's health without the user doing anything different when pressing the button, such as holding a modifier key or clicking with a different mouse button. You can have an addon show you some kind of alert, such as flashing a giant icon on your screen, when you should cast Spell A instead of Spell B, but the addon can't change which spell your button casts based on that information. |
But here's a conditional:
/run local t="target"if (UnitHealth(t) / UnitHealthMax(t)) < 0.90 then SendChatMessage("Die, scum!","yell")end The thing is, this just show a text instead of casting a spell, and for sending chat message, it works. i thought about using modfiers but i already use modifiers to cast different spells with keys: 1-6, f1-f6, and shift as modifier, i guess i have to start using alt and ctrl too. |
Quote:
|
This is what AddOns like AutoRogue used to do in vanilla. It's just plain cheating. You can't do it anymore and I'm glad for it.
|
Ok, thanks! ;)
|
All times are GMT -6. The time now is 02:06 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI