Originally Posted by Coskesh
I'm trying to expand on an ingame macro to free up some actionbar space which requires more than the 250 chars.
Ingame, when I call /hatt via a macro, it gives me this:
[sting "Interface\FrameXML\ChatFrame.lua"]:2043: attempt to call local 'value' (a table value).
I tried to check out ChatFrame.lua, but it doesn't exist in that folder. Thoughts?
|
You could check the code in AutoRepair, it has a couple of commands in there.
It looks like, first I didn't setup the chat handler until after the VARIABLES_LOADED event fired.
like this:
Code:
function AutoRepair_OnEvent(event)
if ( event == "VARIABLES_LOADED" ) then
AR_Load()
end
if ( event == "MERCHANT_SHOW") then
if (CanMerchantRepair() and AR_Save.enabled) then
AR_RepairHandler(false);
end
end
end
this was the code I used to set the slash handler
Code:
SlashCmdList["AUTOREPAIR"] = AR_SlashHandler;
SLASH_AUTOREPAIR1 = "/autorepair";
SLASH_AUTOREPAIR2 = "/ar";
And this is the AR_SlashHandler
Code:
function AR_SlashHandler(msg)
local _,_,command,options = string.find(msg,"([%w%p]+)%s*(.*)$");
if (command) then
command = string.lower(command);
end
if (command == nil or command == "") then
AR_Chat("Current Settings:");
AR_Chat("MinCost: ".. WHITE .. setAmountString(AR_Save.minCost));
AR_Chat("Threshold: " .. WHITE .. setAmountString(AR_Save.costThreshold));
AR_Chat("Prompts: " .. WHITE .. setEnabledString(AR_Save.promptEnabled));
AR_Chat("Verbose: " .. WHITE .. setEnabledString(AR_Save.verbose));
AR_Chat("Skipping Inventory: " .. WHITE .. setEnabledString(AR_Save.skipInv));
AR_Chat("Available Commands:");
AR_Chat("/ar MinCost <number> -- " .. WHITE .."Sets the minimal ammount you wish to ever auto repair for. This is compared to the total repair costs.");
AR_Chat("/ar Threshold <number> -- " .. WHITE .."Sets the most your willing to pay for without being prompt. If your total repair bill is less then your threshold and more than your min. then you'll automatically repair everything.");
AR_Chat("/ar Prompts -- " .. WHITE .."This toggles showing prompts. If prompts are disabled Auto Repair will still repair your stuff as long as you can afford it.");
AR_Chat("/ar Enable -- " .. WHITE .."This turns AutoRepair on and off.");
AR_Chat("/ar Verbose -- " .. WHITE .. "This toggles showing repair ammounts in the chat area after repair has been done.");
AR_Chat("/ar SkipInv -- " .. WHITE .. "This toggles skipping inventory check/repair. If enabled, AR will NOT check your inventory.");
elseif (command == 'enable') then AR_EnableHandler();
elseif (command == 'mincost') then AR_MinCostHandler(options);
elseif (command == 'threshold') then AR_ThresholdHandler(options);
elseif (command == 'prompt') then AR_PromptHandler();
elseif (command == 'verbose') then AR_VerboseHandler();
elseif (command == 'skipinv') then AR_SkipInvHandler();
end
end