Cast first usable spell macro (Probably Advanced)

JerseyFoo

1/g = g-1
Reaction score
40
The other day; I discovered macros. Now I'm trying to create a macro that would cast the first usable action in this order; Shield Block, Revenge, Victory Rush, Shield Slam, Devastate.

Perhaps if blizzard properly documented their own API's and languages I would've discovered this isn't supposed to be do-able -- but having spent time on it I'd like to finish what I started.

Code:
-- blocked
/script local a,b,_; for a=26,30 do DEFAULT_CHAT_FRAME:AddMessage(a) b,_ = IsUsableAction(a) if IsUsableAction(a) then UseAction(a) end end

-- no debug
/script local a; for a=26,32 do if IsUsableAction(a) then UseAction(a) break; end end

-- workaround?
/script (function() for a=26,30 do if IsUsableAction(a) then UseAction(a) end end)()

-- stupid version
/script local a; for a=26,30 do UseAction(a) end

-- really stupid version
/script UseAction(26) UseAction(27) UseAction(28) UseAction(29) UseAction(30)

-- moar workaround
/dump loadstring(" local a; for a=26,32 do if IsUsableAction(a) then UseAction(a) break; end end")()

Thoughts?
 

UndeadDragon

Super Moderator
Reaction score
448
So, are IsUsableAction() and UseAction() valid functions? If so, I'm struggling to see why it doesn't work.
 

JerseyFoo

1/g = g-1
Reaction score
40
UseAction() is a protected function. Meaning Blizzard blocks it from executing because they don't want bots. Probably should've mentioned that.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
If your trying to make a macro to handle a rotation, it's impossible. The macro and AddOn API are specifically designed to prevent that kind of functionality.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top