but since the last patch they changed UseAction to not work for calling itself/other macros
this is what i was using:
ingame(slot59):
Code: Select all
/wait 1
/run Hide();UseAction(59);
Code: Select all
function ChkBuff(tgt, ...)
local counter = 1;
local friendly = UnitIsPlayer(tgt);
local currentbuff = "none";
while (currentbuff ~= nil) do
if friendly then
currentbuff = UnitBuff(tgt, counter);
else
currentbuff = UnitDebuff(tgt, counter);
end
for i,v in pairs(arg) do
if (currentbuff == tostring(v)) then
return true;
end
end
counter = counter + 1;
end
return false;
end
function IsMounted()
local all_mounts = { "horse","ostrich","berhu","wartiger","ferret","dragonfang","boar","rhino","unicorn","rent" }
local counter=0
local buff="none"
repeat
for i,mount in pairs(all_mounts) do
if string.find(string.lower(buff),mount) ~= nil then
return true, counter
end
end
counter=counter+1
buff=UnitBuff("player",counter)
until buff == nil
return false, 0
end
function IsPoisoned()
local all_poisons = { "bleed","poisoned","tear","puncture wound","infection" }
local counter=0
local debuff="none"
repeat
for i,poison in pairs(all_poisons) do
if string.find(string.lower(debuff),poison) ~= nil then
return true, counter
end
end
counter=counter+1
debuff=UnitDebuff("player",counter)
until debuff == nil
return false, 0
end
function Hide()
local counter = 0;
if GetPlayerCombatState("true") then
counter=counter+1;
elseif IsMounted() then
counter=counter+1;
elseif IsPoisoned() then
counter=counter+1;
elseif ChkBuff("player","Hide") then
counter=counter+1;
else CastSpellByName("Hide");
end;
end
using frames/xml to fire off a function on a timer, i thought it could be adepted, but i tried and failed
i wasnt sure where to add my functions into the wiki example or what to modify other than this little part:
Code: Select all
function HelloWorld.Print()
DEFAULT_CHAT_FRAME:AddMessage("Hello, World!")
end
Code: Select all
function HelloWorld.Print()
local counter = 0;
if GetPlayerCombatState("true") then
counter=counter+1;
elseif IsMounted() then
counter=counter+1;
elseif IsPoisoned() then
counter=counter+1;
elseif ChkBuff("player","Hide") then
counter=counter+1;
else CastSpellByName("Hide");
end;
end