Quantcast Questions on macro texts - WoWInterface
Thread Tools Display Modes
09-26-18, 04:06 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,729
Questions on macro texts

I lately wrote myself a pull timer since I do not use DBM or Bigwigs atm.
https://github.com/zorker/rothui/blo...Timer/core.lua

The pull timer activates when I click the pull timer button on my raid manager.
https://github.com/zorker/rothui/blo.../core.lua#L157

What happens is the following. The raid manager has a secure button with a macrotext attribute set to "/pull 3".

The pull timer addon registers the slash command "pull" and reacts on the time given.

It triggers the Pull() function that calls itself recursively as long as there are seconds left. And either /y yells the pull timer or uses /rw in raids. I am able to adjust the pull timer macro text on the fly to print: "Pull in 3", "Pull in 2", "Pull in 1", "Pull now!!!".

I am even able to access WoW API functions like IsInRaid().

That got my thinking. What would prevent me from accessing functions like UnitPower("player") or spell cooldown functions?

If the above holds up shouldn't it be possible to create an addon that registers a slash command like /easywarrior which checks for specific conditions and alternates the macro text to cast specific spells under certain conditions?

All that would be needed is to put an action button on your bar using a macro which is calling /easywarrior.

Did I just get lucky that I (A) either did not test the addon well in combat or (B) the functions I am using right now are part of the secure environment or (C) I have found a hole in the system.

Example
Lua Code:
  1. local MacroEditBox = MacroEditBox
  2. local MacroEditBox_OnEvent = MacroEditBox:GetScript("OnEvent")
  3. local shortcut = "easywarrior"
  4.  
  5. local function EasyWarrior()
  6.   local command = "/cast Shield Block"
  7.   if UnitPower("player") > 60 then
  8.     command = "/cast Ignore Pain"
  9.   end
  10.   MacroEditBox_OnEvent(MacroEditBox, "EXECUTE_CHAT_LINE", command)
  11. end
  12.  
  13. SlashCmdList[shortcut] = function(cmd)
  14.   EasyWarrior()
  15. end
  16. _G["SLASH_"..shortcut.."1"] = "/"..shortcut

*edit*
The above does not work right? Because if it does one could in theory call the function recursively every 0.2 seconds.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-26-18 at 06:03 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Questions on macro texts

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off