LUA inside macro?
I was looking to swap forms depending on conditions, and I have looked at some published macros but they use terminology which I do not understand, they do not work, or a bit of both.
In pseudo code I would like to press the same button to do this: if indoors then Prowl if you can, else Cat if outdoors then travel form if already in some form then cancel form During one of my attempts I tried to use a function (now I forget which) and I got a popup error "function only available to Blizzard UI"... Could anyone please tell me if such a macro can be written ? |
Quote:
https://wow.gamepedia.com/Macro_conditionals |
So if memory serves, and I'm reading that wiki page right, the noform condition indicates you're not shapeshifted and form indicates you are.
Code:
/cancelform [form] |
Quote:
Here's the revised macro Code:
/cast [form] ;[outdoors][swimming] Travel Form; [combat] Cat Form; Prowl Quote:
|
I believe [form:0] is the equivalent to [noform]; of course it doesn't really matter since it doesn't change the amount of characters in use.
Wouldn't the empty [form] cause the macro to then do nothing while in any form causing it to skip Prowl even while in Cat Form? Also, doesn't Travel form already select its form based on internal conditions not unlike [swimming] and [noflying]? |
Thanks for the ingenious macro coding.
Unfortunately it does not work, if Prowl is on CD it should just go to cat, but it just waits for Prowl to become available once more. I will see if I can understand that wiki page. |
OK, this is the macro that might be needed. Unfortunately we are severely limited by the macro buffer size as well as I do not know how to cast spells however I used print statements to show what the macro should do.
/script lST,lDR,lEN=GetSpellCooldown("Prowl");lCD=lST and (lST+lDR-GetTime()) or 9;lFRM=GetShapeshiftForm();lID=IsIndoors();if (lFRM==0) then if (lID) then if (lCD<=0) then print("PR"); else print("CT");end;else print("TR");end;else print("NR");end; |
Just to explain, I do not know how to combine a /script with /cast - eg
/script if (true) then /cast Moonfire; else /cast Sunfire; end; Is that even possible ? |
The spell casting functions are PROTECTED so you cannot call them at will from within your lua code.
Otherwise, you could easily program a bot that plays by itself. https://wow.gamepedia.com/API_CastSpellByName There must always be an active user action triggering a spellcast, which you could maybe do with a SecureActionButtonTemplate. But as far as I understand, this will only allow you to cast one particular spell, so you would not be able to have some logic making the decision about which spell to cast. Otherwise you could make a single button that always executes the ideal next spell of your rotation... |
Maybe you can do something similar to this:
https://us.forums.blizzard.com/en/wo...man-form/64405 So you would have one button, and depending on your current situation you bind the appropriate spell to that button... Have not thought this through. Just what came to mind... |
Quote:
Quote:
Quote:
Quote:
Alternatively, since Prowl doesn't work in combat, it is possible to create a SecureActionButton to run a default macro when in combat and monitor the cooldown when out of combat. This will likely be too large for a macro, so you'll need a custom addon to do it. You can either trigger it from a macro using /click or set a click binding. Quote:
|
I see, just realized what you used [swimming] for, whether you're [indoors] or [outdoors] you'll use Travel Form so long as you're swimming.
And doofus(the OP), if you're not adverse to using modifiers you can always use Alt, Shift, and/or Ctrl. Code:
#showtooltip |
Quote:
Also, the auto-shift to cat form when using Prowl works in all forms. PS: If Prowl is on CD and conditions are met, it would block use of Cat Form. This is why I suggested it should be seperated from the macro or at the very least, used on a modifier. |
All times are GMT -6. The time now is 11:22 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI