update Commands.lua

This commit is contained in:
Crum
2018-07-10 00:30:01 -05:00
parent 0ceb747c76
commit e320e6f9e1
+7 -8
View File
@@ -4,7 +4,7 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
--Lua functions --Lua functions
local _G = _G local _G = _G
local tonumber, type = tonumber, type local tonumber, type = tonumber, type
local format, lower, match = string.format, string.lower, string.match local format, len, lower, match = string.format, string.len, string.lower, string.match
--WoW API / Variables --WoW API / Variables
local UIFrameFadeOut, UIFrameFadeIn = UIFrameFadeOut, UIFrameFadeIn local UIFrameFadeOut, UIFrameFadeIn = UIFrameFadeOut, UIFrameFadeIn
local EnableAddOn, DisableAddOn, DisableAllAddOns = EnableAddOn, DisableAddOn, DisableAllAddOns local EnableAddOn, DisableAddOn, DisableAllAddOns = EnableAddOn, DisableAddOn, DisableAllAddOns
@@ -96,14 +96,13 @@ function E:BGStats()
end end
-- Set up a private editbox to handle macro execution -- Set up a private editbox to handle macro execution
local commando
local editbox = CreateFrame("Editbox", "MacroEditBox") local editbox = CreateFrame("Editbox", "MacroEditBox")
local line
editbox:RegisterEvent("EXECUTE_CHAT_LINE") editbox:RegisterEvent("EXECUTE_CHAT_LINE")
editbox:SetScript("OnEvent", editbox:SetScript("OnEvent", function(self, event)
function(self, event)
if event == "EXECUTE_CHAT_LINE" then if event == "EXECUTE_CHAT_LINE" then
local defaulteditbox = pcall(ChatFrameEditBox) local defaulteditbox = pcall(ChatFrameEditBox)
self:SetText(commando) self:SetText(line)
ChatEdit_SendText(self) ChatEdit_SendText(self)
end end
end end
@@ -115,10 +114,10 @@ local function OnCallback()
end end
function E:DelayScriptCall(msg) function E:DelayScriptCall(msg)
local secs, command = match(msg, "^([^%s]+)%s+(.*)$") local secs, command = match(msg, "^(%S+)%s+(.*)$")
line = command
secs = tonumber(secs) secs = tonumber(secs)
commando = command if (not secs) or (len(command) == 0) then
if not secs or not command then
self:Print("usage: /in <seconds> <command>") self:Print("usage: /in <seconds> <command>")
self:Print("example: /in 1.5 /say hi") self:Print("example: /in 1.5 /say hi")
else else