• 1 page(s)
Implementing Slash Commands

For learning purposes, I'm implementing slash commands into Auto Repair to toggle the use of guild funds for repair.

The code that is part of this is...

local UseGuild = 1

function ar()
    if UseGuild == 1 then
        UseGuild = nil;
        DEFAULT_CHAT_FRAME:AddMessage("Not using guild repair!",100,50,0);
    else
        UseGuild = 1;
        DEFAULT_CHAT_FRAME:AddMessage("Using guild repair!",100,50,0);
    end
end

    SlashCmdList["ar"] = ar()
    SLASH_ar1, SLASH_ar2 = "/ar", "/autorepair";

                    RepairAllItems(UseGuild);

 

I wasn't sure if I should or was allowed to post the whole code but I'd appreciate it if someone could take a look. If I'm allowed to post the whole thing, please say so.

Quixx - 80 DK on Frostwolf

Report this thread post

Something that sticks out to me immediately is that you don't put parentheses behind a function when assigning it to a variable.  That is:

SlashCmdList["ar"] = ar()

should be:

SlashCmdList["ar"] = ar

Report this thread post

Wow....

It was that simple. It works now. Thanks a ton man!

Quixx - 80 DK on Frostwolf

Report this thread post
  • 1 page(s)
Subscribe to this thread: (you will receive emails when new posts are made)