Added 'dnote' and some debug notes

If a skill/spell is tracked and not been used, the 'average' line does not print. This caused script to look for a value that didn't exist. Now the value will be set to '0' if none is found.
master
icecool 6 years ago
parent 88f9ca404e
commit b00898e739

@ -30,9 +30,15 @@
--[[ External Resources ]]-- --[[ External Resources ]]--
dofile(GetInfo(60) .. "aardwolf_colors.lua") -- Used to support Aard Colors for the eprint() function dofile(GetInfo(60) .. "aardwolf_colors.lua") -- Used to support Aard Colors for the eprint() function
-- Basic print function that supports aard, xterm, and ANSI color codes [idea from Durel's Inventory script] -- Basic print function that supports aard, xterm, and ANSI color codes [idea from Durel's Inventory script]
Debug = false
function cnote(string) function cnote(string)
AnsiNote(stylesToANSI(ColoursToStyles(string))) AnsiNote(stylesToANSI(ColoursToStyles(string)))
end end
function dnote(str)
if Debug then
cnote("@R[DEBUG]: @w"..str.."@w")
end
end
function trim(s) function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1")) return (s:gsub("^%s*(.-)%s*$", "%1"))
end end
@ -94,10 +100,14 @@ function TRIGGER_process_dtrack_line(_, line, _, _)
dtrack.regular["sname"] = trim(string.sub(line,returnStringPosition("(",1,line)+1,returnStringPosition("):",1,line)-1)) dtrack.regular["sname"] = trim(string.sub(line,returnStringPosition("(",1,line)+1,returnStringPosition("):",1,line)-1))
else else
if (returnTracked(columnone) ~= -1) then if (returnTracked(columnone) ~= -1) then
dtrack.regular[returnTracked(columnone)] = ("%0.2f"):format(tonumber(trim(string.sub(line, returnStringPosition("[", 1, line)+1, returnStringPosition("]", 1, line)-1)))) dnote(("@D[@GdTrack Reports@D]:@w returnTracked returned @R%s@w. The value found afterwards is @R%0.2f.@w"):format(returnTracked(columnone), tonumber(trim(string.sub(line, returnStringPosition("[", 1, line)+1, returnStringPosition("]", 1, line)-1)))))
local value = ("%0.2f"):format(tonumber(trim(string.sub(line, returnStringPosition("[", 1, line)+1, returnStringPosition("]", 1, line)-1))))
dtrack.regular[returnTracked(columnone)] = value
end end
if (returnTracked(columntwo) ~= -1) then if (returnTracked(columntwo) ~= -1) then
dtrack.regular[returnTracked(columntwo)] = ("%0.2f"):format(tonumber(trim(string.sub( line, returnStringPosition("[", 30, line)+1, returnStringPosition("]", 30, line)-1)))) dnote(("@D[@GdTrack Reports@D]:@w returnTracked returned @R%s@w. The value found afterwards is @R%0.2f.@w"):format(returnTracked(columntwo), tonumber(trim(string.sub(line, returnStringPosition("[", 30, line)+1, returnStringPosition("]", 30, line)-1)))))
local value = ("%0.2f"):format(tonumber(trim(string.sub( line, returnStringPosition("[", 30, line)+1, returnStringPosition("]", 30, line)-1))))
dtrack.regular[returnTracked(columntwo)] = value
end end
end end
end end
@ -158,8 +168,11 @@ function reportSwings()
dtrack.regular.swings, dtrack.regular.swings,
dtrack.regular.hitpercent, dtrack.regular.hitpercent,
dtrack.regular.dph) dtrack.regular.dph)
dnote( message )
if dtrack.regular.sname then if dtrack.regular.sname then
if tonumber(dtrack.regular.trackedavg) == nil then dtrack.regular.trackedavg = 0 end
message = ("%s %s(%0.2f)"):format(message, dtrack.regular.sname, dtrack.regular.trackedavg) message = ("%s %s(%0.2f)"):format(message, dtrack.regular.sname, dtrack.regular.trackedavg)
dnote( message )
end end
SendNoEcho( message ) SendNoEcho( message )
dtrack.regular = nil dtrack.regular = nil
@ -179,9 +192,14 @@ function ALIAS_report(name, line, args)
if args.command:lower() == "help" then if args.command:lower() == "help" then
DREPORT_Help() DREPORT_Help()
return return
elseif args.command:lower() == "debug" then
Debug = not Debug
cnote(("@D[@GdTrack Reports@D]:@w Debug mode is now %s@w."):format(Debug and "@Gon" or "@Roff"))
end end
if not (args.channel) then if not (args.channel) then
dtrack.channel = "echo" dtrack.channel = "echo"
else
dtrack.channel = args.channel
end end
if args.command:lower() == "swings" then if args.command:lower() == "swings" then
EnableTriggerGroup("dtrack_swings", true) EnableTriggerGroup("dtrack_swings", true)

Loading…
Cancel
Save