AutoBuf
Posted: Sat Sep 27, 2014 8:45 am
Hey there, Im trying to make an addon that autobuffs ppl. Details: Person in party/raid types like "warlock" and the alt targets the person and casts the buff on the player.
I think my function is not correct, could someone have a look onto it?
I think my function is not correct, could someone have a look onto it?
Code: Select all
local disabled = false -- Starting value
SLASH_AutoBuffer1 = "/AutoBuffer"
SLASH_AutoBuffer2 = "/AB" -- Add as many variations as you like just increment the number
SlashCmdList["AutoBuffer"] = function(editBox, msg)
if msg then
msg = string.lower(msg)
if msg == "on" then -- on
disabled = false
elseif msg == "off" then -- off
disabled = true
else
disabled = not disabled -- Toggles addon if 'on' or 'off' is not used.
end
if disabled then
SendSystemChat("AutoBuffer is disabled")
SendChatMessage("|H|h|cffFF0000AutoBuffer has been deactivated|h", "party")
else
SendSystemChat("AutoBuffer is enabled")
SendChatMessage("|H|h|cff16DC07AutoBuffer has been activated|h", "party")
end
end
end
local AutoBuffer = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.AutoBuffer = AutoBuffer -- expose it to the global scope
function AutoBuffer.VN()
for xx = 1 , 36 do
if OnMessage(Player(SendChatMessage("Warlock", "Party"))) then
CastSpellByName("Sublimation Weave Curse")
end
end
end;
-- Searches the target for a specified text.
-- Use "player", "target", "party3", "raid1" etc. for tgt parameter.
function OnMessage(Player,SendChatMessage)
local counter=1
local SendChatMessage="none"
while Player ~= nil do
SendChatMessage=text(player,msg)
if message ~= nil then
if string.find(string.lower(target),string.lower(message)) then
return true
else
counter=counter+1
end
end
end
return false
end
local time_remaining = 1 -- in seconds
function AutoBuffer:OnUpdate(elapsed)
if disabled == true then
return
end
-- elapsed is the amount of time in seconds since the last frame tick
time_remaining = time_remaining - elapsed
if time_remaining > 0 then
-- cut out early, we're not ready yet
return
end
time_remaining = 1 -- reset to 2 seconds
self.VN()
end