Originally Posted by
evlow
@derpin8
I haven't tested it as i'm at work, but I believe it would be something like this
PHP Code:
local STF, events = CreateFrame("Frame"), {}
STF:RegisterEvent("CHAT_MSG_WHISPER")
STF:SetScript("OnEvent", onEvent)
STF:Show()
function onEvent(self, event, msg, sender)
if event == "CHAT_MSG_WHISPER" and msg:find("shattering throw") then
CastSpellByName(GetSpellInfo(64382),"target")
return true
end
end
@5:27pm - tested and it should work like this
Thank you so much for this!
Now I am trying to make it wait 3 seconds after the whisper to cast shattering throw but I can't get it to work.
PHP Code:
local STF, events = CreateFrame("Frame"), {}
STF:RegisterEvent("CHAT_MSG_WHISPER")
STF:SetScript("OnEvent", onEvent)
STF:Show()
function onEvent(self, event, msg, sender)
if event == "CHAT_MSG_WHISPER" and msg:lower():match("shattering throw") then
local WhisperTime = GetTime()
end
end
if WhisperTime ~= nil then
if GetTime() >= WhisperTime + 3 then
CastSpellByName(GetSpellInfo(64382),"target")
return true
end
end
What am I doing wrong? Sorry I am really bad at Lua.
Ahh n/m. My mistake was the local before WhisperTime.