WobLight 5 Report post Posted August 29, 2017 I've been recently asked if you can check if you have enough mana for a spell before unshifting in a macro, like auto-dismount addon does. Answer is: you can't. Auto-dismount addon probably hooks error messages to unshift you, but the error reported when you have not enough mana and you're shapeshifted is "not enough mana", thus failing to unshift. Here the supermacro code to reproduce auto-dismount behaviour: Spoiler function GetActiveForm() for i=1,GetNumShapeshiftForms() do if ({GetShapeshiftFormInfo(i)})[3] then return i end end return 0 end function CancelForm() local f = GetActiveForm() if f ~= 0 then CastShapeshiftForm(f) end end if not AutoUnshift then AutoUnshift = {sendError = UIErrorsFrame.AddMessage} function UIErrorsFrame:AddMessage(...) for _,s in { ERR_CANT_INTERACT_SHAPESHIFTED, SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED, SPELL_NOT_SHAPESHIFTED, SPELL_NOT_SHAPESHIFTED_NOSPACE, ERR_EMBLEMERROR_NOTABARDGEOSET, ERR_MOUNT_SHAPESHIFTED, ERR_NOT_WHILE_SHAPESHIFTED, ERR_NO_ITEMS_WHILE_SHAPESHIFTED, ERR_TAXIPLAYERSHAPESHIFTED } do if strfind(arg[1],s,nil,true) then CancelForm() return end end AutoUnshift.sendError(self,unpack(arg)) end end 0 Share this post Link to post Share on other sites
Razorwynd 1 Report post Posted August 29, 2017 Thanks @WobLight! 0 Share this post Link to post Share on other sites
retrorocket 0 Report post Posted August 29, 2017 wait im not sure i understand. i thought you said you can't replicate it, if you can't replicate it what does the code do? 0 Share this post Link to post Share on other sites
WobLight 5 Report post Posted August 30, 2017 10 hours ago, retrorocket said: wait im not sure i understand. i thought you said you can't replicate it, if you can't replicate it what does the code do? You can't check, but you can capture the error trying to. it's not exactly the same. 0 Share this post Link to post Share on other sites