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 ]]--
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]
Debug = false
function cnote(string)
AnsiNote(stylesToANSI(ColoursToStyles(string)))
end
function dnote(str)
if Debug then
cnote("@R[DEBUG]: @w"..str.."@w")
end
end
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
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))
else
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
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
@ -158,8 +168,11 @@ function reportSwings()
dtrack.regular.swings,
dtrack.regular.hitpercent,
dtrack.regular.dph)
dnote( message )
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)
dnote( message )
end
SendNoEcho( message )
dtrack.regular = nil
@ -179,9 +192,14 @@ function ALIAS_report(name, line, args)
if args.command:lower() == "help" then
DREPORT_Help()
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
if not (args.channel) then
dtrack.channel = "echo"
else
dtrack.channel = args.channel
end
if args.command:lower() == "swings" then
EnableTriggerGroup("dtrack_swings", true)

Loading…
Cancel
Save