This is great! I was just looking for something like this, and the two other trackers are for skirmishes only and are a bit outdated, plus either don't update automatically or don't reset automatically. This plugin allows custom trackers, so it's a lot more flexible.
One suggestion, to make your plugin more compatible with other plugins, you need to safely handle the chat received event handler. Right now, if any other plugin is using the chat received handler, and your plugin is loaded afterwards, it will overwrite that plugins handler, causing it not to work.
To do that, simply add this code to your Main.lua (near the beginning to prevent the functions from not being loaded before being called)
Code:
function AddCallback(object, event, callback)
if (object[event] == nil) then
object[event] = callback;
else
if (type(object[event]) == "table") then
table.insert(object[event], callback);
else
object[event] = {object[event], callback};
end
end
return callback;
end
function RemoveCallback(object, event, callback)
if (object[event] == callback) then
object[event] = nil;
else
if (type(object[event]) == "table") then
local size = table.getn(object[event]);
for i = 1, size do
if (object[event][i] == callback) then
table.remove(object[event], i);
break;
end
end
end
end
end
and then change the chat received event to something like this:
Code:
chatHandler = function(f,args)
if(args.ChatType == Turbine.ChatType.Quest) then
local message = args.Message;
if(string.sub(message,1,10) == "Completed:") then
if(CTM.settings:Update(message)) then
CTM.TrackerWindow:refreshCurrentTab();
end
end
end
end
AddCallback(Turbine.Chat, "Received", chatHandler);
It's also a good idea to remove callbacks when your plugin is unloaded. To do this, add the following code at the end of Main.lua
Code:
Plugins["Challenge Tracker"].Unload = function( sender, args )
RemoveCallback(Turbine.Chat, "Received", chatHandler);
end
Can't wait to start using this!