Dont know if Brent got it working for you, I took a look at it again and I have it working now. I royally mucked up the original code.
This is with the dynamic skill meter (at 100% it removes off the list) I couldnt get the recent_skill code to work, I spent a few hours trying to get it working but to no success. Brent will have to get that one to work, but this one shows all skills at <100%, xp, DPS. I used the most recent XP code, instead of the original code I had (which seemed a little buggy) the one Im using now is much better IMO.
Code: Select all
session_start = os.time() - 1
auxbox_next_line = 0
function auxbox()
d:auxbox_clear();
auxbox_next_line = 0
update_skill_experience()
auxbox_real_world_time()
auxbox_blank_line()
auxbox_all_skill_levels()
ched_xp_init()
auxbox_ched_xppmin()
auxbox_damage_per_second()
end
function auxbox_prop_line(prop_name, prop_val)
local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
auxbox_next_line = auxbox_next_line + 1
d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
end
function auxbox_blank_line()
auxbox_next_line = auxbox_next_line + 1
end
function auxbox_real_world_time()
auxbox_prop_line("Real World Time:", string.format(os.date("%I:%M%p")))
end
-- Skill level stuff - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
skill_count = 40
auxbox_class_skills =
{ 0, 1, 2, 3, 26 --fighter
, 17, 18, 13, 14, 15, 9 --thief
, 7, 33 -- mage
, 34, 38, 36 -- priest
, 10, 40 -- monk
}
auxbox_crafting_skills =
{ 4
, 5
, 6
, 8
, 11
, 12
, 16
, 19
, 20
, 21, 22, 23, 24, 25
, 27, 28
, 29
, 30
, 31, 32
, 35, 37
, 39
}
auxbox_prev_skill_values = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
auxbox_skill_last_updated = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
auxbox_prev_skill_values[0] = -1
auxbox_skill_last_updated[0] = -1
auxbox_skill_names =
{ "polearms" -- 1
, "maces" -- 2
, "tactics" -- 3
, "woodcrafting" --4
, "mining" -- 5
, "weaponsmith" -- 6
, "magery" -- 7
, "fishing" -- 8
, "locks" --9
, "unarmed" --10
, "meditation" -- 11
, "alchemy" --12
, "ranged" --13
, "stealth" --14
, "traps" --15
, "item lore" --16
, "shortswords" --17
, "foils" -- 18
, "Skill 19"
, "tailoring" --20
, "tinkering" -- 21
, "Skill 22"
, "Skill 23"
, "Skill 24"
, "Skill 25"
, "block" --26
, "cartography" --27
, "healing" --28
, "enchanting" --29
, "armourer" -- 30
, "inscription" --31
, "taming" --32
, "sorcery" --33
, "piety" --34
, "Skill 35"
, "blessed maces" --36
, "staves" -- 37
, "divinity" --38
, "cooking" --39
, "sanctity" --40
}
auxbox_skill_names[0] = "longswords"
function auxbox_skill_line(skill_index)
if me:get_skill(skill_index) > 0
and me:get_skill(skill_index) < 100
then
auxbox_prop_line(auxbox_skill_names[skill_index], string.format("%.3f%%", me:get_skill(skill_index)))
end
end
-- I used this for debugging, its pretty similar to the skill tab, so kind of pointless, but why delete it, now that it works
function auxbox_all_skill_levels()
for i = 0, skill_count do
auxbox_skill_line(i)
end
end
-- you have to call this before either of the two functions below it or they wont know what has recently changed
function update_skill_experience()
for i = 0, skill_count do
if auxbox_prev_skill_values[i] < me:get_skill(i) then
auxbox_skill_last_updated[i] = auxboxcnt
auxbox_prev_skill_values[i] = me:get_skill(i)
end
end
end
-- beginning of XP-array
req_xp = {}
req_xp[1] = 0 -- fixed XP value
req_xp[2] = 200 -- fixed XP value
req_xp[26] = 93000 -- fixed XP value
for i=3,25 do -- adds XP for lvl 3 to 25 to array
req_xp[i] = math.floor(req_xp[i-1]+1.2*(req_xp[i-1]-req_xp[i-2]))
end
for i=27,1000 do -- adds XP for lvl 27 to 1000 to array
req_xp[i] = req_xp[i-1]+(i-26)*1000*4+15000
end
-- snip snip
-- end of XP-array
ched_init=true
ched_xp_arr={}
function ched_xp_init()
if ched_init then
ched_xp=me.xp
ched_currentlvl=me.lvl-(me.remort_level*75)
ched_lastxp=0
ched_xp_next_level = 0
ched_xp_p_fmin = 0
ched_xp_p_tmin = 0
ched_xp_lasttickxp = me.xp
ched_lasttick = 0
ched_lastname=me.name
ched_init=false
for i=1,600 do
ched_xp_arr[i]=0
end
end
end
function auxbox_ched_xppmin()
if ched_xp<me.xp then
ched_lastxp=me.xp-ched_xp
ched_xp=me.xp
end
if ched_init then
return
end
if ched_lastxp == me.xp
or ched_lastname ~= me.name then
ched_init=true
ched_xp_init()
end
if (os.difftime(os.time(), ched_lasttick)>0) then --We need to run this once per second
ched_xp_next_level = (req_xp[(ched_currentlvl+1)]-me.xp)
if ched_xp_next_level < 0 then --To account for non-meditated levels
ched_currentlvl = ched_currentlvl + 1
end
local xpperminuteftotal = 0
local xpperminutettotal = 0
for i=1,300 do --5 to 10 minutes back
ched_xp_arr[(600-(i-1))]=ched_xp_arr[(600-i)]
xpperminutettotal=xpperminutettotal+ched_xp_arr[(600-(i-1))]
end
for i=1,299 do --0 to 5 minutes back
ched_xp_arr[(300-(i-1))]=ched_xp_arr[(300-i)]
xpperminuteftotal=xpperminuteftotal+ched_xp_arr[(300-(i-1))]
end
ched_xp_arr[1]=me.xp-ched_xp_lasttickxp
xpperminuteftotal=xpperminuteftotal+ched_xp_arr[1]
xpperminutettotal=xpperminutettotal+xpperminuteftotal
ched_xp_p_fmin = math.floor(xpperminuteftotal/5)
ched_xp_p_tmin = math.floor(xpperminutettotal/10)
ched_xp_lasttickxp = me.xp
ched_lasttick=os.time()
end
auxbox_prop_line("XP to next level:", ched_xp_next_level)
auxbox_prop_line("XP/min (10 mins):",string.format("%d(%d)",ched_xp_p_tmin,math.floor(ched_xp_next_level/ched_xp_p_tmin)))
auxbox_prop_line("XP/min (5 mins):",string.format("%d(%d)",ched_xp_p_fmin,math.floor(ched_xp_next_level/ched_xp_p_fmin)))
auxbox_prop_line("Last XP gain:", ched_lastxp)
end
-- explode(seperator, string)
-- from http://lua-users.org/wiki/SplitJoin
function explode(d,p)
local t, ll
t={}
ll=0
if(#p == 1) then return p end
while true do
l=string.find(p,d,ll+1,true) -- find the next d in the string
if l~=nil then -- if "not not" found then..
table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array.
ll=l+1 -- save just after where we found it for searching next time.
else
table.insert(t, string.sub(p,ll)) -- Save what is left in our array.
break -- Break at end, as it should be, according to the lua manual.
end
end
return t
end
VERBOSE_DPS_REPORT = true
last_dpst = g_dpst
hits_recorded = 0
dmg_log = {}
median_damage = -1
recent_hit_times = {}
five_hit_intervals = {}
median_interval = -1
function auxbox_damage_per_second()
local current_time
local current_dmg
local current_five_hit_interval
local temp_var
local temp_five_hit_intervals
local temp_dmg_log
if last_dpst ~= g_dpst then
current_time = os.time()
current_dmg = g_dpst - last_dpst
hits_recorded = hits_recorded + 1
if hits_recorded <= 30 then -- first 30 hits
table.insert(dmg_log, 1, current_dmg)
else -- on and after the 31st hit
table.remove(dmg_log, 30)
table.insert(dmg_log, 1, current_dmg)
end
last_dpst = g_dpst
if hits_recorded < 6 then -- first 5 hits
table.insert(recent_hit_times, 1, current_time)
else -- on and after the 6th hit
table.remove(recent_hit_times, 5)
table.insert(recent_hit_times, 1, current_time)
end
if hits_recorded >= 5 then
current_five_hit_interval = recent_hit_times[1] - recent_hit_times[5]
if hits_recorded <= 35 then -- first 30 "5 hit" intervals
table.insert(five_hit_intervals, 1, current_five_hit_interval)
else -- on and after the 31st "5 hit" interval
table.remove(five_hit_intervals, 30)
table.insert(five_hit_intervals, 1, current_five_hit_interval)
end
end
end
if hits_recorded < 35 then
temp_var = 35 - hits_recorded
auxbox_prop_line("DPS:", string.format("...in %d hits...", temp_var))
if VERBOSE_DPS_REPORT then auxbox_prop_line("Median Damage:", "") end
if VERBOSE_DPS_REPORT then auxbox_prop_line("Median 5-Hit Time:", "") end
else
temp_dmg_log = {}
for i,v in pairs(dmg_log) do
temp_dmg_log[i] = v
end
table.sort(temp_dmg_log)
temp_five_hit_intervals = {}
for i,v in pairs(five_hit_intervals) do
temp_five_hit_intervals[i] = v
end
table.sort(temp_five_hit_intervals)
median_damage = math.ceil((temp_dmg_log[15] + temp_dmg_log[16]) / 2)
median_interval = math.floor((temp_five_hit_intervals[15] + temp_five_hit_intervals[16]) / 2)
temp_var = math.floor((median_damage * 5) / median_interval)
auxbox_prop_line("DPS:", string.format("%d", temp_var))
if VERBOSE_DPS_REPORT then
auxbox_prop_line("Median Damage:", string.format("%d", median_damage))
end
if VERBOSE_DPS_REPORT then
auxbox_prop_line("Median 5-Hit Time:", string.format("%d", median_interval))
end
end
end