Page 2 of 2

Re: AutoBuf

Posted: Mon Sep 29, 2014 10:47 am
by rock5
That would be because there is no VN function. Some earlier code you posted had the VN function but the last lua file you posted didn't. I'm not sure what VN is supposed to do but if all your addon is supposed to do is cast "Sublimation Weave Curse" then the OnEvent function already does that so you could delete that line.

Re: AutoBuf

Posted: Mon Sep 29, 2014 12:20 pm
by Draakje
okay, I get now as soon typed warlock, targettarget and char just targets itself not using a skill/cast

Re: AutoBuf

Posted: Mon Sep 29, 2014 12:28 pm
by Draakje
Removed line:
TargetUnit("player", "event")

not using any skill aswell after typing: warlock

Re: AutoBuf

Posted: Tue Sep 30, 2014 2:23 am
by rock5
Hm... I can't seem to get CastSpellByName to work from the chat line so maybe it's one of those commands that have been disabled. I know a while back it became harder to use some commands in some situations. I'm not exactly sure of all the particulars but thank goodness we can still use all the commands from the bot. I'm not sure what you would need to get it to work. Maybe you should look at trying the party bot. I'm pretty sure it can do everything you need.

Re: AutoBuf

Posted: Tue Sep 30, 2014 10:34 am
by Draakje
I've checked ingame, if i make a macro with CastSpellByName it triggers the skill

Re: AutoBuf

Posted: Tue Sep 30, 2014 11:07 am
by rock5
Macros are different. Because they are triggered by mouse clicks or key presses they work. Entering it on chat doesn't. And I think it wont work if it's triggered by an addons OnUpdate or OnEvent.

Re: AutoBuf

Posted: Tue Sep 30, 2014 2:54 pm
by i1own0u
CastSpellByName("Urgent Heal") break

works fine in addons where i have that as a line.

Re: AutoBuf

Posted: Tue Sep 30, 2014 10:45 pm
by rock5
What addon? How is it being triggered?

Re: AutoBuf

Posted: Wed Oct 01, 2014 11:30 am
by Draakje
Hmm now im curious :p, maybe make small addon to see it works ingame

Re: AutoBuf

Posted: Thu Oct 02, 2014 12:22 pm
by Draakje
Um i've been thinking around. And wondering if I make an addon that triggers a macro ingame by message or warlock by party?
Think it possible? This is not working though ^^
Macro is working individually but not by the addon.

Code: Select all

local disabled = true -- 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.OnEvent(event, arg1, arg2, arg3, arg4)
    if event == "CHAT_MSG_PARTY" then
        if arg1 == "warlock" or "lock" or "locky" or "Warlock" or "blitz" then
            UseAction("1");
        end
    end
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
    AutoBuffer.VN()
end
Ingame Macro:

Code: Select all

/run for i=1,18 do TargetNearestFriend() if UnitIsPlayer("target") then CastSpellByName("Regenerate") else TargetUnit("") end end

Re: AutoBuf

Posted: Fri Oct 03, 2014 4:25 am
by i1own0u
rock5 wrote:What addon? How is it being triggered?
It's custom made.

if CastingBarFrame:IsVisible() then
return
else
for i=1,50 do
if UnitBuff("player",i)=="Chain Drive" then
if UnitHealth("player")/UnitMaxHealth("player")<=.30 then
CastSpellByName("Urgent Heal") break
elseif UnitInRaid("player") then
for i=1, 12 do
TargetUnit("raid"..i)
if UnitExists("target") and UnitIsPlayer("target") then
if UnitHealth("target")/UnitMaxHealth("target")<=.97 then
CastSpellByName("Urgent Heal") break
end
end
end
else

Re: AutoBuf

Posted: Fri Oct 03, 2014 5:07 am
by rock5
That code doesn't repeat so I assume you trigger it with a mouse click or key press, maybe you use it in a macro that you trigger with a mouse click or key press. Either way, that's why it works, because you trigger it with a mouse click or key press. The addon that tries to cast a spell that way, triggered by an event such as OnUpdate, won't work.

Re: AutoBuf

Posted: Sun Oct 05, 2014 1:21 pm
by Draakje
Is there a way to trigger a macro ingame then with an addon?

Re: AutoBuf

Posted: Sun Oct 05, 2014 10:05 pm
by rock5
I'm not sure if there is a command to execute a macro directly but you can put the macro in the action bar and execute it from there.

Code: Select all

UseAction(slotno)
But it wont make any difference. The game somehow knows what initially triggered a command. And if the command was not triggered by a click or key press then it wont work. That's why the bot can execute commands that an addon can't, because it simulates keypresses.

Re: AutoBuf

Posted: Mon Oct 06, 2014 6:07 am
by lisa
rock5 wrote:That's why the bot can execute commands that an addon can't, because it simulates keypresses.
Yup.