From 1adfb443572a0a34c1dea1ac8756df948695f643 Mon Sep 17 00:00:00 2001 From: GryllsAddons <107083057+GryllsAddons@users.noreply.github.com> Date: Sat, 25 Mar 2023 12:23:21 +0000 Subject: [PATCH] Add macro command --- unitscan.lua | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/unitscan.lua b/unitscan.lua index b986e50..77e177b 100644 --- a/unitscan.lua +++ b/unitscan.lua @@ -50,6 +50,8 @@ function unitscan.check_for_targets() unitscan.flash.animation:Play() unitscan.button:set_target() + -- store last target + unitscan.lastTarget = name -- restore prev target if prevTarget then TargetLastTarget() @@ -67,7 +69,9 @@ function unitscan.check_for_zonetargets() unitscan.play_sound() unitscan.flash.animation:Play() unitscan.button:set_target() - + + -- store last target + unitscan.lastTarget = name -- restore prev target if prevTarget then TargetLastTarget() @@ -390,16 +394,10 @@ end function unitscan.toggle_zonetarget(name) -- DEFAULT_CHAT_FRAME:AddMessage("DEBUG: unitscan: toggle_zonetarget") - local key = name - if unitscan_zonetargets[key] then - unitscan_zonetargets[key] = nil - -- unitscan.print('- ' .. key) - + if unitscan_zonetargets[name] then + unitscan_zonetargets[name] = nil + unitscan.print(name .. ' was found!') unitscan.reloadtimer = GetTime() + 60 -- trigger reload zone timer - -- DEFAULT_CHAT_FRAME:AddMessage("DEBUG: unitscan: reload timer started") - elseif key ~= '' then - unitscan_zonetargets[key] = true - -- unitscan.print('+ ' .. key) end end @@ -414,4 +412,11 @@ function SlashCmdList.UNITSCAN(parameter) else unitscan.toggle_target(name) end +end + +SLASH_UNITSCANTARGET1 = '/unitscantarget' +function SlashCmdList.UNITSCANTARGET() + if unitscan.lastTarget then + TargetByName(unitscan.lastTarget, true) + end end \ No newline at end of file