Custom Auxbox Creations

Moderator: EUO Moderators

Post Reply
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: Custom Auxbox Creations

Post by eggmceye »

hard to please some people :fp:
Chedich
on lolpatrol
Posts: 254
Joined: Wed Jan 14, 2004 12:51 am

Re: Custom Auxbox Creations

Post by Chedich »

If you used alt+m to set it up in game you probably used the framework I set up. You should be able to find it here on the forums if that's what you want to use.
User avatar
treos
I once posted in TFIOOC!
Posts: 110
Joined: Fri Dec 21, 2012 12:23 am

Re: Custom Auxbox Creations

Post by treos »

Chedich wrote: Wed Sep 16, 2020 2:58 am If you used alt+m to set it up in game you probably used the framework I set up. You should be able to find it here on the forums if that's what you want to use.
ty, think i found the right one here. https://forums.swut.net/viewtopic.php?f ... ive#p93872 it works and has the alt+m and other key combos to configure it in-game.

also, egg, my main problem with the other one was that the "config" character file simply wasn't loading even when renaming it to the name of my character and hitting alt+F5 in-game. i don't know what the problem was because i did as you said and renamed the auxbox file to lua and the config file to charactername.lua as well.

chedich's is just easier to config from in-game. (ty for that btw, chedich)
Chedich
on lolpatrol
Posts: 254
Joined: Wed Jan 14, 2004 12:51 am

Re: Custom Auxbox Creations

Post by Chedich »

I think brentoboy's config file was supposed to be renamed to charname.AUX :geek:
User avatar
treos
I once posted in TFIOOC!
Posts: 110
Joined: Fri Dec 21, 2012 12:23 am

Re: Custom Auxbox Creations

Post by treos »

Chedich wrote: Wed Sep 16, 2020 5:48 am I think brentoboy's config file was supposed to be renamed to charname.AUX :geek:
:fp: dammit... well, what's done is done and i have chedich's scripts now and they'll work fine for me.
User avatar
Keighn
Stop posting already --;
Posts: 5509
Joined: Sat Jun 26, 2004 10:13 am
Location: Hey.... pssttt Back in Orgeon

Re: Custom Auxbox Creations

Post by Keighn »

MOON_PHASE looks nice.

Code: Select all

-- Start
auxbox_next_line = 0
session_time = 0
sessionstart = os.time()
shiftkeys={"Shift","Alt","Ctrl+Shift","Shift+Alt","Ctrl+Alt","Ctrl+Alt+Shift","RMB","Ctrl+RMB"}
old_build = {   
   me:get_float_str(),
   me:get_float_dex(),
   me:get_float_intel(),
   wl:get_full_name(me.weapon),
   wl:get_full_name(me.shield),
   wl:get_full_name(me.armour),
   wl:get_full_name(me.boots),
   wl:get_full_name(me.gloves),
   wl:get_full_name(me.hat),
   wl:get_full_name(me.trousers),
   wl:get_full_name(me.ring1),
   wl:get_full_name(me.ring2),
   wl:get_full_name(me.amulet),
   wl:get_full_name(me.sigil1),
   wl:get_full_name(me.sigil2),
   wl:get_full_name(me.sigil3)
}
lm_last_dpst = g_dpst       
lm_dmg_log = {}
lm_hit_count = 0
lm_last_xp = me.xp
lm_xp_log = {}
lm_xptime_log = {}
lm_kill_count = 0
lm_dmgt_log = {}
lm_last_dtpst = g_dtpst
-- 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
if me.xp >= req_xp[1000] then
   current_level = 1000
else
   for i = 1,999 do -- getting current player level based on array 
      if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
         current_level = i
         break
      end
   end
end     
-- Instances
lm_instancemap_log = {}
lm_instance_list = { 
   [54] = "Mino Halls", 
   [55] = "Mino Halls", 
   [56] = "Mino Halls", 
   [57] = "Mino Halls", 
   [58] = "Mino Halls",
   [59] = "Mino Halls", 
   [60] = "Mino Halls", 
   [61] = "Mino Halls",
   [63] = "Mt. Pass", 
   [64] = "Mt. Pass", 
   [65] = "Mt. Pass", 
   [66] = "Mt. Pass",
   [67] = "Pendragon", 
   [68] = "Pendragon", 
   [69] = "Pendragon", 
   [70] = "Pendragon",
   [90] = "KToS",
   [110] = "Wiz Tower", 
   [111] = "Wiz Tower", 
   [112] = "Wiz Tower", 
   [113] = "Wiz Tower", 
   [114] = "Wiz Tower",
   [115] = "Wiz Tower", 
   [116] = "Wiz Tower", 
   [117] = "Wiz Tower",
   [120] = "Tangled", 
   [121] = "Tangled", 
   [122] = "Tangled", 
   [123] = "Tangled", 
   [124] = "Tangled",
   [125] = "Tangled", 
   [126] = "Tangled", 
   [127] = "Tangled", 
   [128] = "Tangled",
   [136] = "Cass Tower", 
   [137] = "Cass Tower",
   [175] = "Rivers End", 
   [176] = "Rivers End", 
   [177] = "Rivers End", 
   [178] = "Rivers End", 
   [179] = "Rivers End",
   [180] = "Rivers End",
   [182] = "VotT", 
   [183] = "VotT", 
   [184] = "VotT", 
   [185] = "VotT", 
   [186] = "VotT",
   [196] = "CoS",
   [230] = "Anathema", 
   [231] = "Anathema", 
   [232] = "Anathema", 
   [233] = "Anathema", 
   [234] = "Anathema",
   [235] = "Anathema", 
   [236] = "Anathema",
   [282] = "Blood Moor"
}
-- -- -- -- -- -- -- -- -- -- --
function auxbox()
   local w=d:auxbox_get_width()
   local h=d:auxbox_get_height()
   auxbox_lm_dpscalc()
   d:auxbox_clear();
   auxbox_next_line = 0
   auxboxfunc()
end

-- Real World Time - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
function auxbox_time()
   auxbox_prop_line("Real World Time:", string.format(os.date("%I:%M%p")))
   if os.difftime(os.time(), sessionstart) > session_time then -- just to reduce the script to every second
      session_time = os.difftime(os.time(), sessionstart)
      session_d_float = session_time / 60 / 60 / 24
      session_d = math.floor(session_d_float)
      session_h = math.floor((session_d_float - session_d)*24)
      session_m = math.floor(((session_d_float - session_d)*24 - session_h) * 60)
      session_s = math.floor((((session_d_float - session_d)*24 - session_h) * 60 - session_m) * 60)
   end    
   if session_d~=nil then
      auxbox_prop_line("Session time:", string.format("%02.f:%02.f:%02.f:%02.f", session_d, session_h, session_m, session_s))   
   end 
end


function auxbox_prop_line(prop_name, prop_val)
   local pvl=0
   if prop_name==nil then prop_name="" end
   if prop_val==nil then prop_val="" end
   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 auxboxfunc()
   auxbox_lm_dpscalc()
   d:auxbox_clear()
   auxbox_time()
   auxbox_blank_line()
   auxbox_strdex()
   auxbox_blank_line()
   auxbox_lm_time()
   auxbox_lm_hits()
   auxbox_lm_kills()
   auxbox_lm_dmg()
   auxbox_lm_dps()
   auxbox_lm_xp_gained()
   auxbox_lm_xppm()
   auxbox_xp()
   auxbox_blank_line()
   auxbox_lm_last4dmg()
   auxbox_blank_line()
   auxbox_lm_last4dmgt()
   auxbox_blank_line()
   auxbox_lm_last4xp()
   auxbox_blank_line()
   auxbox_lm_dynamic_instance_reset()
   auxbox_blank_line()
   -- auxbox_bound_item_basecodes()
   Items_Left()
end


function auxbox_lm_dpscalc ()
   local new_build = {   
      me:get_float_str(),
      me:get_float_dex(),
      me:get_float_intel(),
      wl:get_full_name(me.weapon),
      wl:get_full_name(me.shield),
      wl:get_full_name(me.armour),
      wl:get_full_name(me.boots),
      wl:get_full_name(me.gloves),
      wl:get_full_name(me.hat),
      wl:get_full_name(me.trousers),
      wl:get_full_name(me.ring1),
      wl:get_full_name(me.ring2),
      wl:get_full_name(me.amulet),
      wl:get_full_name(me.sigil1),
      wl:get_full_name(me.sigil2),
      wl:get_full_name(me.sigil3)
   }
   for i=1,#old_build do
        if old_build[i] ~= new_build[i] then
         table.remove (old_build, i)
         table.insert (old_build, i, new_build[i])
         for i,v in pairs(lm_dmg_log) do
            lm_dmg_log[i]=nil
         end
         for i,v in pairs(lm_dmgtime_log) do
            lm_dmgtime_log[i]=nil
         end
         for i,v in pairs(lm_xp_log) do
            lm_dmg_log[i]=nil
         end
         for i,v in pairs(lm_xptime_log) do
            lm_dmgtime_log[i]=nil
         end
         for i,v in pairs(lm_dmgt_log) do
            lm_dmgt_log[i]=nil
         end
         lm_hit_count = 0
         lm_kill_count = 0
      end  
    end
   if lm_hit_count == 0 then
      lm_hunt_start = os.clock()
      lm_last_killtime = os.clock()
      lm_dmg_start = g_dpst
      lm_xp_start = me.xp
      lm_dmgt_start = g_dtpst
   end
   lm_hunt_time = os.clock() - lm_hunt_start  
   lm_total_dmg = g_dpst - lm_dmg_start
   lm_xp_gained = me.xp - lm_xp_start
   lm_total_dmgt = g_dtpst - lm_dmgt_start
   local lm_dmg_dif
    if lm_last_dpst ~= g_dpst then
      lm_dmg_dif = g_dpst - lm_last_dpst
      table.insert(lm_dmg_log, 1, lm_dmg_dif)
      lm_last_dpst = g_dpst
      lm_hit_count = lm_hit_count + 1
   end
   local lm_dmgt_dif
   if lm_last_dtpst ~= g_dtpst then
      lm_dmgt_dif = g_dtpst - lm_last_dtpst
      table.insert(lm_dmgt_log, 1, lm_dmgt_dif)
      lm_last_dtpst = g_dtpst
   end    
   local lm_xptime_dif
   local lm_xp_dif
   if lm_last_xp ~= me.xp and lm_hit_count >= 1 then
      lm_kill_count = lm_kill_count + 1
      lm_xptime_dif = os.clock() - lm_last_killtime
      table.insert(lm_xptime_log, 1, lm_xptime_dif)
      lm_last_killtime = os.clock()
      lm_xp_dif = me.xp - lm_last_xp
      table.insert(lm_xp_log, 1, lm_xp_dif)
      lm_last_xp = me.xp   
   end    
   local lm_xptime_count = 0
   lm_xptime_sum = 0  
    if lm_xptime_log[1] ~= nil then
        for i,v in pairs(lm_xptime_log) do
            if type(v) == 'number' then
            lm_xptime_sum = lm_xptime_sum + v
            lm_xptime_count = lm_xptime_count + 1
            if lm_xptime_count >= 500 then
               table.remove(lm_xptime_log, 500)
            end
         end
      end
    end
   local lm_xp_count = 0
   lm_xp_sum = 0
    if lm_xp_log[1] ~= nil then
        for i,v in pairs(lm_xp_log) do
            if type(v) == 'number' then
            lm_xp_sum = lm_xp_sum + v
            lm_xp_count = lm_xp_count + 1
            if lm_xp_count >= 500 then
               table.remove(lm_xp_log, 500)
            end
            end
        end
    end
end


function auxbox_lm_hits()
   auxbox_prop_line("Total Hits  :", string.format("%d",lm_hit_count))
end


function auxbox_lm_time()
   h = math.floor(lm_hunt_time / 60 / 60)
   m = math.floor((lm_hunt_time / 60 / 60 - h) * 60)
   s = math.floor(((lm_hunt_time / 60 / 60 - h) * 60 - m) * 60)
   auxbox_prop_line("Total Time  :", string.format("%02.f:%02.f:%02.f", h, m, s))
end


function auxbox_lm_dmg()
   auxbox_prop_line("Total Dmg   :", string.format("%d",lm_total_dmg))
end


function auxbox_lm_dps()
   if lm_hunt_time == 0 then
   auxbox_prop_line("Total Dps   :", 0)
   else
   auxbox_prop_line("Total Dps   :", string.format("%d", lm_total_dmg/lm_hunt_time))
   end
end


function auxbox_lm_last4dmg()
   local hit1, hit2, hit3, hit4
   if lm_dmg_log[1] ~= nill then hit1 = lm_dmg_log[1] else hit1 = 0 end
   if lm_dmg_log[2] ~= nill then hit2 = lm_dmg_log[2] else hit2 = 0 end
   if lm_dmg_log[3] ~= nill then hit3 = lm_dmg_log[3] else hit3 = 0 end
   if lm_dmg_log[4] ~= nill then hit4 = lm_dmg_log[4] else hit4 = 0 end
   auxbox_prop_line("Last Few Hits:", "")
   auxbox_prop_line(string.format("%4.f  %4.f  %4.f  %4.f", hit4, hit3, hit2, hit1))
end


function auxbox_lm_last4dmgt()
   local hit1, hit2, hit3, hit4
   if lm_dmgt_log[1] ~= nill then hit1 = lm_dmgt_log[1] else hit1 = 0 end
   if lm_dmgt_log[2] ~= nill then hit2 = lm_dmgt_log[2] else hit2 = 0 end
   if lm_dmgt_log[3] ~= nill then hit3 = lm_dmgt_log[3] else hit3 = 0 end
   if lm_dmgt_log[4] ~= nill then hit4 = lm_dmgt_log[4] else hit4 = 0 end
   auxbox_prop_line("Last 4 hits taken:")
   auxbox_prop_line(string.format("%4.f  %4.f  %4.f  %4.f", hit4, hit3, hit2, hit1))
end


function auxbox_lm_kills()
   auxbox_prop_line("Total Kills :", string.format("%d", lm_kill_count))
end


function auxbox_lm_xp_gained()
   auxbox_prop_line("Total XP    :", string.format("%d", lm_xp_gained))
end


function auxbox_lm_xppm()
   if lm_hunt_time == 0 then
      auxbox_prop_line("Total XP/min:", string.format("%d", 0))
   else
      auxbox_prop_line("Total XP/min:", string.format("%d", lm_xp_gained / lm_hunt_time * 60))
   end
end 


function auxbox_lm_last4xp()
   local kill1, kill2, kill3, kill4
   if lm_xp_log[1] ~= nill then kill1 = lm_xp_log[1] else kill1 = 0 end
   if lm_xp_log[2] ~= nill then kill2 = lm_xp_log[2] else kill2 = 0 end
   if lm_xp_log[3] ~= nill then kill3 = lm_xp_log[3] else kill3 = 0 end
   if lm_xp_log[4] ~= nill then kill4 = lm_xp_log[4] else kill4 = 0 end
   auxbox_prop_line("Last 4 kills:")
   auxbox_prop_line(string.format("%4.f  %4.f  %4.f  %4.f", kill4, kill3, kill2, kill1))
end


function auxbox_xp()
   if me.xp >= req_xp[1000] then
   current_level = 1000
   else
      for i = 1,999 do -- getting current player level based on array 
         if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
            current_level = i
            break
         end
      end
   end
   if current_level <= 1000 then
      local xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level]) -- % needed for next level
      local lvl_float = current_level + me.remort_level * 75 + xptolvl_float -- combines actual lvl with the % needed for next lvl
      -- checks if player leveled or remorted
      if xptolvl_float >= 1 or xptolvl_float < 0 then
         for i = 1,999 do
            if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
               current_level = i
               break
            end
         end
      end
      local xptolvl = req_xp[current_level+1] - me.xp
        auxbox_prop_line("Level" ,string.format("%f",lvl_float))
      auxbox_prop_line("Current XP", string.format("%d", me.xp))
      auxbox_prop_line("Before Level", string.format("%d", xptolvl))
   end
end


function auxbox_strdex()
   local strpct = (me:get_str()/(me:get_str()+me:get_dex())*100)
   local dexpct = (me:get_dex()/(me:get_str()+me:get_dex())*100)
   auxbox_prop_line("Str : Dex", string.format("%.2f : %.2f",strpct,dexpct))
end


function Items_Left()
   auxbox_prop_line("Items Left")
   auxbox_prop_line("Mega Yellows :        ", items:get_qty_basecode(363))
   auxbox_prop_line("Other Yellows:--------", items:get_qty_basecode(260))
   auxbox_prop_line("Purple Pots  :        ", items:get_qty_basecode(360))
   auxbox_prop_line("Omelettes    :--------", items:get_qty_basecode(1380))
   auxbox_prop_line("Dragon Rats  :        ", items:get_qty_basecode(1399))
   auxbox_prop_line("Greater      :--------", items:get_qty_basecode(12))
   auxbox_prop_line("Protect      :        ", items:get_qty_basecode(1297))
   auxbox_prop_line("Sanct Lor    :--------", items:get_qty(make_code(286,0,0,18)))
   auxbox_prop_line("Kal Ort Por  :        ", items:get_qty(make_code(286,0,0,13)))
   auxbox_prop_line("Town Portal  :--------", items:get_qty_basecode(293))
   auxbox_prop_line("Bandages     :        ", items:get_qty_basecode(375))
   auxbox_prop_line("Empty Flasks :--------", items:get_qty_basecode(335))
   auxbox_prop_line("Blank Scroll :        ", items:get_qty_basecode(1053))
   auxbox_prop_line("Beverages    :--------", items:get_qty_basecode(205))
   -- auxbox_prop_line("Mega Blue Potions:", items:get_qty_basecode(364))
   -- auxbox_prop_line("Blue Potions:", items:get_qty_basecode(261))
   -- auxbox_prop_line("Brown Potions:", items:get_qty_basecode(358))
   -- auxbox_prop_line("Khaki Potions:", items:get_qty_basecode(380))
   -- auxbox_prop_line("White Potions:", items:get_qty_basecode(354))
   -- auxbox_prop_line("Cyan Potions:", items:get_qty_basecode(356))
   -- auxbox_prop_line("Orange Potions:", items:get_qty_basecode(355))
   -- auxbox_prop_line("Scroll of Health:", items:get_qty_basecode(1298))
   -- auxbox_prop_line("Black Potions:", items:get_qty_basecode(352))
   -- auxbox_prop_line("Arrows:", items:get_qty_basecode(296))
   -- auxbox_prop_line("Bullets:", items:get_qty_basecode(1294))
   -- auxbox_prop_line("Soul Shards:", items:get_qty_basecode(1283))
   -- auxbox_prop_line("Clear Potions :", items:get_qty_basecode(359))
   -- auxbox_prop_line("Lime Potions:", items:get_qty_basecode(357))
   -- auxbox_prop_line("Green Potions:", items:get_qty_basecode(353))
   -- auxbox_prop_line("Black Potions:", items:get_qty_basecode(352))
   -- auxbox_prop_line("Black Pearl:", items:get_qty_basecode(326))
   -- auxbox_prop_line("Garlic :", items:get_qty_basecode(328))
   -- auxbox_prop_line("Ginseng :", items:get_qty_basecode(329))
   -- auxbox_prop_line("Nightshade:", items:get_qty_basecode(331))
    -- auxbox_prop_line("Refined Scroll Health:", items:get_qty_basecode(323))
    -- auxbox_prop_line("Uncurse Scroll", items:get_qty_basecode(315))
   -- auxbox_prop_line("Unweld Scroll", items:get_qty_basecode(314))
   -- auxbox_prop_line("Grappling Hook", items:get_qty_basecode(313))
   -- auxbox_prop_line("Red Potion", items:get_qty_basecode(263))
end


function auxbox_lm_dynamic_instance_reset()
   if cmap:get_level() ~= me.map_level and cmap:get_level() >= 0 then
      if lm_instance_list[cmap:get_level()] ~= nil then
         lm_parentmap = lm_instance_list[cmap:get_level()]
      else lm_parentmap = cmap:get_level()
      end
      lm_tempmap = me.map_level
      lm_instance_visited = 1
      lm_instance_exit = os.time()
   end 
   if cmap:get_level() == me.map_level and lm_instance_visited == 1 then
      lm_instance_visited = 0  
      lm_instancemap_log[lm_parentmap] = lm_instance_exit
   end
   local lm_instance_reset = 0
   for i, v in pairs(lm_instancemap_log) do
      lm_instance_reset = 600 - (os.time() - v) 
      local m = math.floor(lm_instance_reset / 60)
      local s = math.floor((lm_instance_reset / 60 - m) * 60) 
      auxbox_prop_line(string.format("%s resets in",i),string.format("%02.f:%02.f", m, s))     
      if lm_instance_reset <= 0 then
         lm_instancemap_log[i] = nil
      end
   end
end

-- Bound Item Quantities(modified to show basecodes)  - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
function auxbox_bound_item_basecodes()
   local item
   local name
   for i = 1, 50 do   
      item = me.item_binds[i]
      name = wl:get_full_name(item)  
      if item and not wl:is_tool(item) and name ~= "NOTHING" then   
         auxbox_prop_line(name, get_base_code(item))
      end
   end
end
Ok, I really don't know how messed up this is. (lvl 1k alts at max xp just blank out most of the data so I have no idea how to fix that). I also tried to insert the moon_phase thing just under time and it just blanked out the who thing. Code hates me. Not sure whta all is useful to be honest that others utilize that I might find cool.

This is simple called auxbox.lua in clientscripts folder. (naturally I save a copy of the one that works).
ZUPS!!!!
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Custom Auxbox Creations

Post by speed »

Updated Keighn's auxbox with colours and more tabs (shift-Q / shift-A to cycle between tabs)!

Page 1:
  • Time
  • str/dex
  • LM's dps script
  • LM's level script
  • LM's last 4 hits/dmg/xp script
  • LM's instance reset script
  • Coloured item list
Page 2:
  • Time
  • Age
  • my hunger script
  • Bound item basecodes
  • Second coloured item list
Page 3:
  • LM's ascii map (borderless)

Code: Select all

------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
--                                                                          --
--                             DEFINING VARIABLES                           --
--                                                                          --
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------

-- General
session_time = 0
sessionstart = os.time()
shiftkeys={"Shift","Alt","Ctrl+Shift","Shift+Alt","Ctrl+Alt","Ctrl+Alt+Shift","RMB","Ctrl+RMB"}

-- Instances - Add to this list when new map instances are released!
lm_instancemap_log = {}
lm_instance_list = {
   [27] = "Netherterra",
   [38] = "Apoc Newbie",
   [47] = "Nordhausen",
   [54] = "Mino Halls", [55] = "Mino Halls", [56] = "Mino Halls", [57] = "Mino Halls", [58] = "Mino Halls",[59] = "Mino Halls", [60] = "Mino Halls", [61] = "Mino Halls",
   [63] = "Mt. Pass", [64] = "Mt. Pass", [65] = "Mt. Pass", [66] = "Mt. Pass",
   [67] = "Pendragon", [68] = "Pendragon", [69] = "Pendragon", [70] = "Pendragon",
   [90] = "KToS",
   [110] = "Wiz Tower",
   [111] = "I. Badland", [112] = "I. Badland",
   [120] = "Tangled F.", [121] = "Tangled F.", [122] = "Tangled F.", [123] = "Tangled F.", [124] = "Tangled F.", [125] = "Tangled F.", [126] = "Tangled F.", [127] = "Tangled F.", [128] = "Tangled F.",
   [130] = "Lunacy", [131] = "Lunacy",
   [136] = "Cass Tower", [137] = "Cass Tower",
   [175] = "Rivers End", [176] = "Rivers End", [177] = "Rivers End", [178] = "Rivers End", [179] = "Rivers End", [180] = "Rivers End",
   [182] = "VotT", [183] = "VotT", [184] = "VotT", [185] = "VotT", [186] = "VotT",
   [195] = "Dead F.",
   [196] = "CoS",
   [198] = "Z. Pyramid", [199] = "Z. Pyramid", [200] = "Z. Pyramid",
   [230] = "Anathema", [231] = "Anathema", [232] = "Anathema", [233] = "Anathema", [234] = "Anathema", [235] = "Anathema", [236] = "Anathema",
   [237] = "Deja Vu", [238] = "Deja Vu", 
   [250] = "Matriarch",
   [259] = "Phoenix T.",
   [260] = "ToLS", [261] = "ToLS", [262] = "ToLS",
   [275] = "Death Night",
   [276] = "U. North",
   [277] = "Blood Moor", [278] = "Blood Moor", [279] = "Blood Moor", [280] = "Blood Moor", [281] = "Blood Moor", [282] = "Blood Moor",
   [284] = "Carnival", [285] = "Carnival"
}

-- Slides and Keybinds - if you don't need a slide, you can comment it out of the list (though pay attention to the commas!)
slides_list = {
  "XP and Items", -- Slide 1
  "Additional Info",   -- Slide 2
  "ASCII Map"     -- Slide 3
}
default_slide = 1 -- Initial auxbox slide on startup

next_slide = 65 -- ASCII for the key required to cycle slides forwards (increases slide_counter by 1)
prev_slide = 81 -- ASCII for the key required to cycle slides backwards (decreases slide_counter by 1)

reset_dps = 88 -- (X) ASCII for the key required to reset LM's dps calculations
pause_dps = 77 -- (M) ASCII for the key required to pause/play LM's dps calculations

------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
--                                                                          --
--                                 PAGE SELECT                              --
--                                                                          --
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------

function auxbox()
   -- Important variables for setup
  local w=d:auxbox_get_width()
  local h=d:auxbox_get_height()
  auxbox_text_width = 27
  d:auxbox_clear();
  auxbox_next_line = 0
  
  -- These functions run regardless of the current slide
  auxbox_lm_dpscalc()
  auxbox_lm_dynamic_instance_reset()
  check_reset_lm_dpscalc()
  check_pause_lm_dpscalc()

  if slides_list[current_slide+1] == "XP and Items" then ----------------------------------------------- Slide 1
    
    auxbox_time()

    auxbox_blank_line()
    auxbox_strdex()

    auxbox_blank_line()
    auxbox_lm_time()
    auxbox_lm_hits()
    auxbox_lm_kills()
    auxbox_lm_dmg()
    auxbox_lm_dps()
    auxbox_lm_xp_gained()
    auxbox_lm_xppm()
    auxbox_xp()

    auxbox_blank_line()
    auxbox_lm_last4dmg()
    auxbox_blank_line()
    auxbox_lm_last4dmgt()
    auxbox_blank_line()
    auxbox_lm_last4xp()

    auxbox_blank_line()
    auxbox_lm_dynamic_instance_reset_print()

    auxbox_blank_line()
    auxbox_prop_line("{47F}------- Items Left --------{FFF}")

    auxbox_blank_line()
    --[[ HOW THE COLOURED ITEM COUNT WORKS:
    --  1) The first number is the basecode of the item (363 = Mega Yellow)                         
    --  2) The second number is the quantity. If you have more than this number, the number will be 
    --      coloured green. If you have less, the number will slowly shift to red.                  
    --  3) The third bool (true/false) lets you toggle the max limit in the display.                
    --      true shows '30/30'      false just shows '30'                                           
    --  4) The fourth string allows you to optionally add a name, instead of auto-generating it.    
    --      you can use item_color_indicator() instead of item_color_indicator_name                 ]]
    
    --                        CODE QTY SHOWMAX  OPTIONAL NAME OF ITEM
    item_color_indicator_name(363, 10, false,  "Mega Yellows {999}:        {FFF}")
    item_color_indicator_name(260, 10, false,  "Other Yellows{999}:--------{FFF}")
    item_color_indicator_name(360, 10, false,  "Purple Pots  {999}:        {FFF}")
    item_color_indicator_name(1380, 10, false, "Omelettes    {999}:--------{FFF}")
    item_color_indicator_name(1399, 10, false, "Dragon Rats  {999}:        {FFF}")
    item_color_indicator_name(12, 10, false,   "Greater      {999}:--------{FFF}")
    item_color_indicator_name(1297, 10, false, "Protect      {999}:        {FFF}")
    item_color_indicator_name(make_code(286,0,0,18), 10, false, "Sanct Lor    {999}:--------{FFF}")
    item_color_indicator_name(make_code(286,0,0,13), 10, false, "Kal Ort Por  {999}:        {FFF}")
    item_color_indicator_name(293, 10, false,  "Town Portal  {999}:--------{FFF}")
    item_color_indicator_name(375, 10, false,  "Bandages     {999}:        {FFF}")
    item_color_indicator_name(335, 10, false,  "Empty Flasks {999}:--------{FFF}")
    item_color_indicator_name(1035, 10, false, "Blank Scroll {999}:        {FFF}")
    item_color_indicator_name(205, 10, false,  "Beverages    {999}:--------{FFF}")




  elseif slides_list[current_slide+1] == "Additional Info" then ---------------------------------------- Slide 2

    auxbox_time()

    auxbox_blank_line()
    character_age()

    auxbox_blank_line()
    auxbox_blank_line()
    auxbox_hunger_bar()

    auxbox_blank_line()
    auxbox_prop_line("{47F}-- Bound Item Basecodes ---{FFF}")
    auxbox_bound_item_basecodes()

    auxbox_blank_line()
    auxbox_prop_line("{47F}------- Items Left --------{FFF}")

    auxbox_blank_line()
    item_color_indicator(364, 10, false) -- Mega Blue Potions
    item_color_indicator(261, 10, false) -- Blue Potions
    item_color_indicator(358, 10, false) -- Brown Potions
    item_color_indicator(380, 10, false) -- Khaki Potions
    item_color_indicator(354, 10, false) -- White Potions
    item_color_indicator(356, 10, false) -- Cyan Potions
    item_color_indicator(355, 10, false) -- Orange Potions
    item_color_indicator(1298, 10, false) -- Scrolls of Health
    item_color_indicator(352, 10, false) -- Black Potions
    item_color_indicator(296, 10, false) -- Arrows
    item_color_indicator(1294, 10, false) -- Bullets
    item_color_indicator(1283, 10, false) -- Soul Shards
    item_color_indicator(359, 10, false) -- Clear Potions
    item_color_indicator(357, 10, false) -- Lime Potions
    item_color_indicator(353, 10, false) -- Green Potions
    item_color_indicator(326, 10, false) -- Black Pearl
    item_color_indicator(328, 10, false) -- Garlic
    item_color_indicator(329, 10, false) -- Ginseng
    item_color_indicator(331, 10, false) -- Nightshade
    item_color_indicator(323, 10, false) -- Refined Scrolls of Health
    item_color_indicator(315, 10, false) -- Uncurse Scrolls
    item_color_indicator(314, 10, false) -- Unweld Scrolls
    item_color_indicator(313, 10, false) -- Grappling Hooks
    item_color_indicator(263, 10, false) -- Red Potions



  elseif slides_list[current_slide+1] == "ASCII Map" then ---------------------------------------------- Slide 3

    if h >= 1 then
      auxbox_prop_line(auxbox_lm_ascii_map(h-2, false)) -- toggle true/false to show distance markers
      auxbox_blank_line()
    else
      auxbox_prop_line("Cannot load ASCII Map")
      auxbox_prop_line("Please Increase Resolution")
      auxbox_blank_line()
    end

    

  else ----------------------------------------------------------------------------------------- Slide not found
    auxbox_prop_line("You are now on slide:", string.format(current_slide + 1))
    auxbox_blank_line()
    auxbox_prop_line("There is no content here!")
    auxbox_blank_line()
    auxbox_prop_line("Set number_of_slides to a")
    auxbox_prop_line("lower value, or make sure")
    auxbox_prop_line("that the slide is properly")
    auxbox_prop_line("initialized!")
    auxbox_go_to_line("??) Missing Page", nil, h - 2)
  end

  -- Show the 'page select' bar on the bottom two lines
  auxbox_go_to_line(string.format("{47F}%02.f) "..slides_list[current_slide+1], current_slide+1), nil, h - 2)
  auxbox_go_to_line("{47F}<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)
  auxbox_slides()
end

------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
--                                                                          --
--                          GENERAL AUXBOX FUNCTIONS                        --
--                                                                          --
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------

function auxbox_blank_line()
   auxbox_next_line = auxbox_next_line + 1
end

----------------------------------------------------------------------------------------------------------------
--[[ Insert line, prop_name is on the left, prop_val is on the right - Edited by Speed to support colours]]

function auxbox_prop_line(prop_name, prop_val)
  if prop_name==nil then prop_name="" end
  if prop_val==nil then prop_val="" end
  
  local prop_name_len = string.len(prop_name) -- find text length, accounting for color codes (Speed)
  local prop_val_len = string.len(prop_val)
  local num_color_codes = 0 -- keep track of the # of color codes in prop_name, to account for them when taking the substr
  for find_color_codes in string.gmatch(prop_name, "{%w%w%w}") do prop_name_len = prop_name_len - 5; num_color_codes = num_color_codes + 1 end
  for find_color_codes in string.gmatch(prop_val, "{%w%w%w}") do prop_val_len = prop_val_len - 5 end

  auxbox_next_line = auxbox_next_line + 1

  -- default prop_line, when all of the text fits on screen
  if (prop_name_len+prop_val_len) < auxbox_text_width-1 then
    local filler = string.rep(" ", auxbox_text_width - prop_name_len - prop_val_len-2)
    d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
  else

    -- remove full color codes that come after the cutoff point
    local color_cutoff_substr = ""
    local temp_substr = string.sub(prop_name, auxbox_text_width-1-prop_val_len+num_color_codes*5, string.len(prop_name))
    for find_color_codes in string.gmatch(temp_substr, "{%w%w%w}") do
      num_color_codes = num_color_codes - 1
      color_cutoff_substr = find_color_codes
    end
    
    -- if the text needs to be chopped, do this:
    if prop_val=="" then
      -- when prop_val exists, make sure it doesn't cut off a color code
      local last_printed_pos = auxbox_text_width+num_color_codes*5
      -- remove color codes that are halfway cut-off
      temp_substr = string.sub(prop_name, last_printed_pos-3, last_printed_pos) -- last 4 printed prop_name chars
      if string.find(temp_substr, "{") ~= nil then
        local color_cutoff_pos = string.find(temp_substr, "{") + last_printed_pos-4
        color_cutoff_substr = string.sub(prop_name, color_cutoff_pos, color_cutoff_pos+4)
        num_color_codes = num_color_codes-1
      end
      last_printed_pos = auxbox_text_width+num_color_codes*5 -- update the spacing info
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, auxbox_text_width-prop_val_len+num_color_codes*5)..color_cutoff_substr)
    else
      -- when prop_val exists, make sure it doesn't cut off a color code
      local last_printed_pos = auxbox_text_width-1-prop_val_len+num_color_codes*5
      -- remove color codes that are halfway cut-off
      temp_substr = string.sub(prop_name, last_printed_pos-3, last_printed_pos) -- last 4 printed prop_name chars
      if string.find(temp_substr, "{") ~= nil then
        local color_cutoff_pos = string.find(temp_substr, "{") + last_printed_pos-4
        color_cutoff_substr = string.sub(prop_name, color_cutoff_pos, color_cutoff_pos+4)
        num_color_codes = num_color_codes-1
      end
      last_printed_pos = auxbox_text_width-1-prop_val_len+num_color_codes*5 -- update the spacing info
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, last_printed_pos)..color_cutoff_substr.." "..prop_val)
    end
  end
end

----------------------------------------------------------------------------------------------------------------
-- [[ Insert line with word wrap - Speed ]]

function auxbox_prop_line_wrap(prop_name, prop_val)
  if prop_name==nil then prop_name="" end
  if prop_val==nil then prop_val="" end
  local prop_name_len = string.len(prop_name)
  local prop_val_len = string.len(prop_val)

  for find_color_codes in string.gfind(prop_val, "{%w%w%w}") do prop_val_len = prop_val_len - 5 end
  if prop_val_len > auxbox_text_width then prop_val_len = 0 end -- Make sure prop_val is not too long

  while prop_name_len > auxbox_text_width do -- Repeat until prop_name is completely written out
    local num_color_codes = 0
    local end_of_substring = auxbox_text_width
    
    local i = 1
    while i < end_of_substring do
      if string.find(string.sub(prop_name, i, i), "{") ~= nil then
        end_of_substring = end_of_substring + 5
        num_color_codes = i
      end
      i = i + 1
    end

    auxbox_next_line = auxbox_next_line + 1 -- Print each full line of prop_name
    d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, end_of_substring))
    prop_name = string.sub(prop_name, end_of_substring+1)
    prop_name_len = string.len(prop_name)
  end

  if auxbox_text_width > prop_name_len + prop_val_len then -- Print the last prop_name line and prop_val
    auxbox_prop_line(prop_name, prop_val)
  else
    auxbox_prop_line(prop_name, nil)
    auxbox_prop_line(nil, prop_val)
  end
end

----------------------------------------------------------------------------------------------------------------
-- [[ Jump to line - Speed ]]

function auxbox_go_to_line(prop_name, prop_val, go_to_line)
  local pvl=0
  if prop_name==nil then prop_name="" end
  if prop_val==nil then prop_val="" end
  local filler = string.rep(" ", auxbox_text_width - string.len(prop_name) - string.len(prop_val))
  d:auxbox_set_line(go_to_line, string.format("%s %s %s", prop_name, filler, prop_val))
end

----------------------------------------------------------------------------------------------------------------
--[[ Auxbox Slides ]]

function auxbox_keypressed(key,ch,scancode) -- Check for keyboard input
 if gc_interface_mode==NORMAL then gch=ch end
end

current_slide = 0
number_of_slides = #slides_list
gch=0                 -- Reset ASCII input value (gch is the ASCII code for the button pressed)
slide_counter = default_slide - 1

function auxbox_slides()
  if gch == next_slide then
    slide_counter = slide_counter + 1
  elseif gch == prev_slide then
    slide_counter = slide_counter - 1
  end
  gch = 0
  current_slide = slide_counter % number_of_slides
end

----------------------------------------------------------------------------------------------------------------
--[[ Real World Time - Duncan (PD) / Zen (Reg) / Brentoboy (forums) / Speed (Reg)]]

function auxbox_time()
  auxbox_prop_line("{47F}Real World Time:", "{FFF}"..string.format(os.date("%I:%M %p")))
   if os.difftime(os.time(), sessionstart) > session_time then -- just to reduce the script to every second
  
    session_time = os.difftime(os.time(), sessionstart)
    session_d_float = session_time / 60 / 60 / 24
    session_d = math.floor(session_d_float)
    session_h = math.floor((session_d_float - session_d)*24)
    session_m = math.floor(((session_d_float - session_d)*24 - session_h) * 60)
    session_s = math.floor((((session_d_float - session_d)*24 - session_h) * 60 - session_m) * 60)
  end
  
   if session_d~=nil then
     auxbox_prop_line("{47F}Session Time:", "{FFF}"..string.format("%02.f:%02.f:%02.f:%02.f", session_d, session_h, session_m, session_s))
   end 
end

----------------------------------------------------------------------------------------------------------------

function round(num , idp)
  local mult = 10^(idp or 0)
  return math.floor(num * mult + 0.5) / mult
end

------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
--                                                                          --
--                      LordMortiferus' XP/DPS FUNCTIONS                    --
--                                                                          --
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------

-- 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,1022 do -- adds XP for lvl 27 to 1000 to array
   req_xp[i] = req_xp[i-1]+(i-26)*1000*4+15000
end
if me.xp >= req_xp[1000] then
   current_level = 1000
else
   for i = 1,999 do -- getting current player level based on array 
      if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
         current_level = i
         break
      end
   end
end   

-- DPS Setup
--[[
old_build = {   
   me:get_float_str(),
   me:get_float_dex(),
   me:get_float_intel(),
   wl:get_full_name(me.weapon),
   wl:get_full_name(me.shield),
   wl:get_full_name(me.armour),
   wl:get_full_name(me.boots),
   wl:get_full_name(me.gloves),
   wl:get_full_name(me.hat),
   wl:get_full_name(me.trousers),
   wl:get_full_name(me.ring1),
   wl:get_full_name(me.ring2),
   wl:get_full_name(me.amulet),
   wl:get_full_name(me.sigil1),
   wl:get_full_name(me.sigil2),
   wl:get_full_name(me.sigil3)
}]]
lm_last_dpst = g_dpst       
lm_dmg_log = {}
lm_hit_count = 0
lm_last_xp = me.xp
lm_xp_log = {}
lm_xptime_log = {}
lm_kill_count = 0
lm_dmgt_log = {}
lm_last_dtpst = g_dtpst

lm_dpscalc_pause = false
lm_curr_pause_start = 0
lm_curr_pause_time = 0
lm_total_pause_time = 0
lm_pause_hit_count = 0

----------------------------------------------------------------------------------------------------------------
-- [[ Speed: press the 'reset_dps' button to reset all XP info, without reseting the entire auxbox ]]

function check_reset_lm_dpscalc()
  if gch == reset_dps then
    lm_last_dpst = g_dpst       
    lm_dmg_log = {}
    lm_hit_count = 0
    lm_last_xp = me.xp
    lm_xp_log = {}
    lm_xptime_log = {}
    lm_kill_count = 0
    lm_dmgt_log = {}
    lm_last_dtpst = g_dtpst
    lm_dpscalc_pause = false
    lm_curr_pause_start = 0
    lm_curr_pause_time = 0
    lm_total_pause_time = 0
    lm_pause_hit_count = 0
  end
end

function check_pause_lm_dpscalc() -- Speed
  if gch == pause_dps then -- Check for keypress
    lm_dpscalc_pause = not lm_dpscalc_pause

    if lm_dpscalc_pause == true then -- When pausing, start the pause timer
      lm_curr_pause_start = os.clock()
      lm_pause_hit_count = g_dpst
    else -- When unpaused, add the current pause time to the total pause time
      lm_total_pause_time = lm_total_pause_time + lm_curr_pause_time
    end
  end
  if lm_dpscalc_pause == true then -- If currently paused, update the pause timer
    lm_curr_pause_time = os.clock() - lm_curr_pause_start
    if lm_pause_hit_count ~= g_dpst then -- if you hit something, end the pause
      lm_dpscalc_pause = false
      lm_total_pause_time = lm_total_pause_time + lm_curr_pause_time
    end
  end
end

----------------------------------------------------------------------------------------------------------------
--[[ Main DPS Functions ]]

function auxbox_lm_dpscalc ()

  if lm_dpscalc_pause == false then

    --[[       -- Note: this equipment-updating glitches out with f-to-fire
    local new_build = {
      me:get_float_str(),
      me:get_float_dex(),
      me:get_float_intel(),
      wl:get_full_name(me.weapon),
      wl:get_full_name(me.shield),
      wl:get_full_name(me.armour),
      wl:get_full_name(me.boots),
      wl:get_full_name(me.gloves),
      wl:get_full_name(me.hat),
      wl:get_full_name(me.trousers),
      wl:get_full_name(me.ring1),
      wl:get_full_name(me.ring2),
      wl:get_full_name(me.amulet),
      wl:get_full_name(me.sigil1),
      wl:get_full_name(me.sigil2),
      wl:get_full_name(me.sigil3)
    }
    for i=1,#old_build do
      if old_build[i] ~= new_build[i] then
        table.remove (old_build, i)
        table.insert (old_build, i, new_build[i])
        for i,v in pairs(lm_dmg_log) do
          lm_dmg_log[i]=nil
        end
        for i,v in pairs(lm_dmgtime_log) do
          lm_dmgtime_log[i]=nil
        end
        for i,v in pairs(lm_xp_log) do
          lm_dmg_log[i]=nil
        end
        for i,v in pairs(lm_xptime_log) do
          lm_dmgtime_log[i]=nil
        end
        for i,v in pairs(lm_dmgt_log) do
          lm_dmgt_log[i]=nil
        end
        lm_hit_count = 0
        lm_kill_count = 0
      end  
    end
    ]]

    if lm_hit_count == 0 then
      lm_hunt_start = os.clock()
      lm_last_killtime = os.clock()
      lm_dmg_start = g_dpst
      lm_xp_start = me.xp
      lm_dmgt_start = g_dtpst
    end
    lm_hunt_time = os.clock() - lm_hunt_start - lm_total_pause_time
    lm_total_dmg = g_dpst - lm_dmg_start
    lm_xp_gained = me.xp - lm_xp_start
    lm_total_dmgt = g_dtpst - lm_dmgt_start
    local lm_dmg_dif
    if lm_last_dpst ~= g_dpst then
      lm_dmg_dif = g_dpst - lm_last_dpst
      table.insert(lm_dmg_log, 1, lm_dmg_dif)
      lm_last_dpst = g_dpst
      lm_hit_count = lm_hit_count + 1
    end
    local lm_dmgt_dif
    if lm_last_dtpst ~= g_dtpst then
      lm_dmgt_dif = g_dtpst - lm_last_dtpst
      table.insert(lm_dmgt_log, 1, lm_dmgt_dif)
      lm_last_dtpst = g_dtpst
    end    
    local lm_xptime_dif
    local lm_xp_dif
    if lm_last_xp ~= me.xp and lm_hit_count >= 1 then
      lm_kill_count = lm_kill_count + 1
      lm_xptime_dif = os.clock() - lm_last_killtime - lm_total_pause_time
      table.insert(lm_xptime_log, 1, lm_xptime_dif)
      lm_last_killtime = os.clock()
      lm_xp_dif = me.xp - lm_last_xp
      table.insert(lm_xp_log, 1, lm_xp_dif)
      lm_last_xp = me.xp   
    end    
    local lm_xptime_count = 0
    lm_xptime_sum = 0  
    if lm_xptime_log[1] ~= nil then
      for i,v in pairs(lm_xptime_log) do
        if type(v) == 'number' then
          lm_xptime_sum = lm_xptime_sum + v
          lm_xptime_count = lm_xptime_count + 1
          if lm_xptime_count >= 500 then
            table.remove(lm_xptime_log, 500)
          end
        end
      end
    end
    local lm_xp_count = 0
    lm_xp_sum = 0
    if lm_xp_log[1] ~= nil then
      for i,v in pairs(lm_xp_log) do
        if type(v) == 'number' then
          lm_xp_sum = lm_xp_sum + v
          lm_xp_count = lm_xp_count + 1
          if lm_xp_count >= 500 then
            table.remove(lm_xp_log, 500)
          end
        end
      end
    end
  end
end


function auxbox_lm_hits()
   auxbox_prop_line("Total Hits  :", string.format("%d",lm_hit_count))
end


function auxbox_lm_time()
   h = math.floor(lm_hunt_time / 60 / 60)
   m = math.floor((lm_hunt_time / 60 / 60 - h) * 60)
   s = math.floor(((lm_hunt_time / 60 / 60 - h) * 60 - m) * 60)
   auxbox_prop_line("Total Time  :", string.format("%02.f:%02.f:%02.f", h, m, s))
end


function auxbox_lm_dmg()
   auxbox_prop_line("Total Dmg   :", string.format("%d",lm_total_dmg))
end


function auxbox_lm_dps()
   if lm_hunt_time == 0 then
   auxbox_prop_line("Total Dps   :", 0)
   else
   auxbox_prop_line("Total Dps   :", string.format("%d", lm_total_dmg/lm_hunt_time))
   end
end


function auxbox_lm_last4dmg()
   local hit1, hit2, hit3, hit4
   if lm_dmg_log[1] ~= nill then hit1 = lm_dmg_log[1] else hit1 = 0 end
   if lm_dmg_log[2] ~= nill then hit2 = lm_dmg_log[2] else hit2 = 0 end
   if lm_dmg_log[3] ~= nill then hit3 = lm_dmg_log[3] else hit3 = 0 end
   if lm_dmg_log[4] ~= nill then hit4 = lm_dmg_log[4] else hit4 = 0 end
   auxbox_prop_line("{AAF}Last Few Hits:", "{FFF}")
   auxbox_prop_line(string.format("{2F2}%4.f  %4.f  %4.f  %4.f{FFF}", hit4, hit3, hit2, hit1))
end


function auxbox_lm_last4dmgt()
   local hit1, hit2, hit3, hit4
   if lm_dmgt_log[1] ~= nill then hit1 = lm_dmgt_log[1] else hit1 = 0 end
   if lm_dmgt_log[2] ~= nill then hit2 = lm_dmgt_log[2] else hit2 = 0 end
   if lm_dmgt_log[3] ~= nill then hit3 = lm_dmgt_log[3] else hit3 = 0 end
   if lm_dmgt_log[4] ~= nill then hit4 = lm_dmgt_log[4] else hit4 = 0 end
   auxbox_prop_line("{AAF}Last 4 hits taken:{FFF}")
   auxbox_prop_line(string.format("{F00}%4.f  %4.f  %4.f  %4.f{FFF}", hit4, hit3, hit2, hit1))
end


function auxbox_lm_kills()
   auxbox_prop_line("Total Kills :", string.format("%d", lm_kill_count))
end


function auxbox_lm_xp_gained()
   auxbox_prop_line("Total XP    :", string.format("%d", lm_xp_gained))
end


function auxbox_lm_xppm()
   if lm_hunt_time == 0 then
      auxbox_prop_line("Total XP/min:", string.format("%d", 0))
   else
      auxbox_prop_line("Total XP/min:", string.format("%d", lm_xp_gained / lm_hunt_time * 60))
   end
end 


function auxbox_lm_last4xp()
   local kill1, kill2, kill3, kill4
   if lm_xp_log[1] ~= nill then kill1 = lm_xp_log[1] else kill1 = 0 end
   if lm_xp_log[2] ~= nill then kill2 = lm_xp_log[2] else kill2 = 0 end
   if lm_xp_log[3] ~= nill then kill3 = lm_xp_log[3] else kill3 = 0 end
   if lm_xp_log[4] ~= nill then kill4 = lm_xp_log[4] else kill4 = 0 end
   auxbox_prop_line("{AAF}Last 4 kills{FFF}:")
   auxbox_prop_line(string.format("{CC0}%4.f  %4.f  %4.f  %4.f{FFF}", kill4, kill3, kill2, kill1))
end  

function auxbox_strdex()
   local strpct = (me:get_str()/(me:get_str()+me:get_dex())*100)
   local dexpct = (me:get_dex()/(me:get_str()+me:get_dex())*100)
   auxbox_prop_line("Str : Dex", string.format("%.2f : %.2f",strpct,dexpct))
end

----------------------------------------------------------------------------------------------------------------
-- [[ General XP Table ]]

function auxbox_xp()
   if me.xp >= req_xp[1000] then
   current_level = 1000
   else
      for i = 1,999 do -- getting current player level based on array 
         if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
            current_level = i
            break
         end
      end
   end
   if current_level <= 1000 then
      local xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level]) -- % needed for next level
      local lvl_float = current_level + me.remort_level * 75 + xptolvl_float -- combines actual lvl with the % needed for next lvl
      -- checks if player leveled or remorted
      if xptolvl_float >= 1 or xptolvl_float < 0 then
         for i = 1,999 do
            if req_xp[i] <= me.xp and req_xp[i + 1] > me.xp then
               current_level = i
               break
            end
         end
      end
      local xptolvl = req_xp[current_level+1] - me.xp

      auxbox_prop_line("{CC8}Level{CC0}" ,string.format("%f",lvl_float).."{FFF}")
      auxbox_prop_line("{CC8}Current XP{CC0}", string.format("%d", me.xp).."{FFF}")
      auxbox_prop_line("{CC8}Before Level{CC0}", string.format("%d", xptolvl).."{FFF}")
   end
end

------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
--                                                                          --
--                           OTHER ADD-ON FUNCTIONS                         --
--                                                                          --
--[[]]--[[]]--[[]]--[[]]--                            --[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------

--[[ Character Age, Original by LordMortiferus ]]

function character_age()
  age_d= math.floor(me.age / 60 / 24)
  age_h= math.floor((me.age / 60 / 24 - age_d)*24)
  age_m= math.floor(((me.age / 60 / 24 - age_d)*24 - age_h) * 60)
  auxbox_prop_line(string.format("{47F}Age: {FFF}"..age_d.."{6F7}d, {FFF}"..age_h.."{6F7}h, {FFF}"..age_m.."{6F7}m"))
end

----------------------------------------------------------------------------------------------------------------
--[[ Instance reset timer - LordMortiferus ]]

function auxbox_lm_dynamic_instance_reset()

  if cmap:get_level() ~= me.map_level and cmap:get_level() >= 0 then
    if lm_instance_list[cmap:get_level()] ~= nil then
       lm_parentmap = lm_instance_list[cmap:get_level()]
    else lm_parentmap = cmap:get_level()
    end
    lm_tempmap = me.map_level
    lm_instance_visited = 1
    lm_instance_exit = os.time()
  end 
  if cmap:get_level() == me.map_level and lm_instance_visited == 1 then
    lm_instance_visited = 0  
    lm_instancemap_log[lm_parentmap] = lm_instance_exit
  end
end

function auxbox_lm_dynamic_instance_reset_print() -- Speed: I split this function in two to keep it consistently loaded across slides

  local lm_instance_reset = 0
  for i, v in pairs(lm_instancemap_log) do
    lm_instance_reset = 600 - (os.time() - v) 
    local m = math.floor(lm_instance_reset / 60)
    local s = math.floor((lm_instance_reset / 60 - m) * 60) 
    auxbox_prop_line(string.format("{2F2}%s {999}resets in{FFF}",i),string.format("%02.f:%02.f", m, s))     
    if lm_instance_reset <= 0 then
       lm_instancemap_log[i] = nil
    end
  end
end

----------------------------------------------------------------------------------------------------------------
--[[ Item stock colour display - Speed ]]

function item_color_indicator(item_code, max_amt_item, show_max)
  local item_name = ""
  item_color_indicator_name(item_code, max_amt_item, show_max, item_name)
end

function item_color_indicator_name(item_code, max_amt_item, show_max, item_name)

  local item_amount = items:get_qty(Item(item_code))
  local color_percent = item_amount * 16 / max_amt_item
  local color_red= round((16 - color_percent) * 2)
  if color_red < 0 then color_red = 0 end
  if color_red > 15 then color_red = 15 end
  color_red = string.format("%x", color_red)
  local color_green = round((2 * color_percent))
  if color_green < 0 then color_green = 0 end
  if color_green > 15 then color_green = 15 end
  color_green = string.format("%x", color_green)

  if item_amount > 999 then -- Max item limit to display is 999. Show "xxx" if higher.
    item_amount = "xxx"
  else
    item_amount = tostring(item_amount)
  end
  if max_amt_item > 999 then
    max_amt_item = "xxx"
  else
    max_amt_item = tostring(max_amt_item)
  end

  local item_color = ("{"..tostring(color_red)..tostring(color_green).."0}"..item_amount)
  local item_color_full = ""
  if show_max then
    item_color_full = item_color.."/"..max_amt_item
  else
    item_color_full = item_color
  end
  if item_name == "" then item_name = wl:get_full_name(Item(item_code)) end
  auxbox_prop_line("{FFF}"..item_name:gsub("^%l", string.upper), item_color_full.."{FFF}")

end

----------------------------------------------------------------------------------------------------------------
-- [[ Bound Item Quantities(modified to show basecodes)  - Duncan (PD) / Zen (Reg) / Brentoboy (forums) ]]

function auxbox_bound_item_basecodes()
   local item
   local name
   for i = 1, 50 do   
      item = me.item_binds[i]
      name = wl:get_full_name(item)  
      if item and not wl:is_tool(item) and name ~= "NOTHING" then   
         auxbox_prop_line(name, get_base_code(item))
      end
   end
end

----------------------------------------------------------------------------------------------------------------
--[[ Hunger Bar - Speed]]

function auxbox_hunger_bar()

  local current_hunger = me.hunger
  local hunger_min = 0
  local hunger_weak = 50
  local hunger_hungry = 125
  local hunger_default = 500
  local hunger_satiated = 1300
  local hunger_max = 2000
  local hunger_percent = current_hunger / (hunger_max - hunger_min)

  local color_percent = (current_hunger - hunger_min) * 16 / (hunger_satiated - hunger_min) -- Color ranges from hunger_min to hunger_satiated
  local hunger_color = ""
  if (current_hunger > hunger_max or current_hunger < hunger_min) then
    hunger_color = "{A00}"
  else
    local color_red = round((16 - color_percent) * 2)
    if color_red < 0 then color_red = 0 end
    if color_red > 15 then color_red = 15 end
    color_red = string.format("%x", color_red)
    local color_green = round((2 * color_percent))
    if color_green < 0 then color_green = 0 end
    if color_green > 15 then color_green = 15 end
    color_green = string.format("%x", color_green)
    hunger_color = "{"..color_red..color_green.."0}"
  end
  
  local hunger_next_status = ""
  if current_hunger < hunger_min then
    hunger_next_status = "Starving at "..hunger_min
  elseif current_hunger < hunger_weak then
    hunger_next_status = "Weak at "..hunger_weak
  elseif current_hunger < hunger_hungry then
    hunger_next_status = "Hungry at "..hunger_hungry
  elseif current_hunger < hunger_default then
    hunger_next_status = "Satiated at "..hunger_satiated
  elseif current_hunger < hunger_satiated then
    hunger_next_status = "Satiated at "..hunger_satiated
  elseif current_hunger < hunger_max then
    hunger_next_status = "Bloated at "..hunger_max
  else -- Bloated
    hunger_next_status = "Bloated"
  end

  if (me:get_health(HN_SICK) == -1) then  -- If sick, can't eat
    current_hunger = "SICK"
    hunger_next_status = "Cannot Eat"
  end
  local hunger_bar_length = 25
  local hunger_me_num_length = string.len(tostring(current_hunger))
  local hunger_num_filled = hunger_bar_length - hunger_me_num_length - 2
  local hunger_num_left = round(hunger_num_filled * hunger_percent)
  if hunger_num_left < 0 then hunger_num_left = 0 end
  if hunger_num_left > hunger_num_filled then hunger_num_left = hunger_num_filled end
  local hunger_fill_left = string.rep("#", hunger_num_left) 
  local hunger_fill_right = string.rep("-", hunger_num_filled - string.len(hunger_fill_left))
  auxbox_prop_line("{CCF}Hunger:", "{BBB}("..hunger_next_status..")")
  auxbox_prop_line("{47F}["..hunger_color..hunger_fill_left.." "..current_hunger.." "..hunger_fill_right.."{47F}".."]")

end

----------------------------------------------------------------------------------------------------------------
--[[ ASCII map for Auxbox - LordMortiferus ]]

function auxbox_lm_ascii_map(h, show_bounds)
  local asciimap = {}
  local tilexy = 0
  
  if show_bounds then h = h-2 end

  local x_radius = 13
  local y_radius = math.floor((h-2)/2)

  -- scan of xy-cords around player
  sx=me.x-x_radius
  ex=me.x+x_radius
  sy=me.y-y_radius
  ey=me.y+y_radius
    
  for yy=sy,ey do
    for xx=sx,ex do
      tilexy = tilexy + 1
     -- checks if player is near an edge of a map
      if yy < 0 or xx < 0 or yy > cmap:get_max_y() or xx > cmap:get_max_x() then
        table.insert (asciimap,tilexy,"{000} ")
      elseif yy == me.y and xx == me.x then -- marks the player as a X on the map
        table.insert (asciimap,tilexy,"{f00}X")
      elseif (cmap:is_mountain(xx,yy)) then
        table.insert (asciimap,tilexy,"{888}A")
      elseif (cmap:is_forest(xx,yy)) then
        table.insert (asciimap,tilexy,"{060}&")
      elseif (cmap:is_lava(xx,yy)) then
        table.insert (asciimap,tilexy,"{a20}w")
      elseif (cmap:is_swamp(xx,yy)) then
        table.insert (asciimap,tilexy,"{073},")
      elseif (cmap:is_deep_water(xx,yy)) then
        table.insert (asciimap,tilexy,"{00f}W")
      elseif (cmap:is_void(xx,yy)) then
        table.insert (asciimap,tilexy,"{000} ")
      elseif (cmap:is_wet(xx,yy)) then
        table.insert (asciimap,tilexy,"{05f}w")
      elseif tiledata:is_blocking(cmap:get_tile(xx,yy))==true then
        table.insert (asciimap,tilexy,"{bbb}#")
      else
        table.insert (asciimap,tilexy,"{0f0}.") -- for anything that is not defined above but can be seen
      end
    end

    if tilexy == x_radius * 2 + 1 then
      tilexy = 0
      auxbox_prop_line(string.format("%s", table.concat(asciimap)))
      for i,v in pairs(asciimap) do
        asciimap[i]=nil
      end
    end
  end
  
  if show_bounds then
    auxbox_prop_line("","{fff}|    |    |    |    |   ")
    auxbox_prop_line("","{fff}10   5    0    5    10  ")
  end
end

----------------------------------------------------------------------------------------------------------------
-- UNCOLORED ITEM COUNTERS (No longer in use)
--[[
function Items_Left()

   auxbox_prop_line("Mega Yellows :        ", items:get_qty_basecode(363))
   auxbox_prop_line("Other Yellows:--------", items:get_qty_basecode(260))
   auxbox_prop_line("Purple Pots  :        ", items:get_qty_basecode(360))
   auxbox_prop_line("Omelettes    :--------", items:get_qty_basecode(1380))
   auxbox_prop_line("Dragon Rats  :        ", items:get_qty_basecode(1399))
   auxbox_prop_line("Greater      :--------", items:get_qty_basecode(12))
   auxbox_prop_line("Protect      :        ", items:get_qty_basecode(1297))
   auxbox_prop_line("Sanct Lor    :--------", items:get_qty(make_code(286,0,0,18)))
   auxbox_prop_line("Kal Ort Por  :        ", items:get_qty(make_code(286,0,0,13)))
   auxbox_prop_line("Town Portal  :--------", items:get_qty_basecode(293))
   auxbox_prop_line("Bandages     :        ", items:get_qty_basecode(375))
   auxbox_prop_line("Empty Flasks :--------", items:get_qty_basecode(335))
   auxbox_prop_line("Blank Scroll :        ", items:get_qty_basecode(1053))
   auxbox_prop_line("Beverages    :--------", items:get_qty_basecode(205))
   -- auxbox_prop_line("Mega Blue Potions:", items:get_qty_basecode(364))
   -- auxbox_prop_line("Blue Potions:", items:get_qty_basecode(261))
   -- auxbox_prop_line("Brown Potions:", items:get_qty_basecode(358))
   -- auxbox_prop_line("Khaki Potions:", items:get_qty_basecode(380))
   -- auxbox_prop_line("White Potions:", items:get_qty_basecode(354))
   -- auxbox_prop_line("Cyan Potions:", items:get_qty_basecode(356))
   -- auxbox_prop_line("Orange Potions:", items:get_qty_basecode(355))
   -- auxbox_prop_line("Scroll of Health:", items:get_qty_basecode(1298))
   -- auxbox_prop_line("Black Potions:", items:get_qty_basecode(352))
   -- auxbox_prop_line("Arrows:", items:get_qty_basecode(296))
   -- auxbox_prop_line("Bullets:", items:get_qty_basecode(1294))
   -- auxbox_prop_line("Soul Shards:", items:get_qty_basecode(1283))
   -- auxbox_prop_line("Clear Potions :", items:get_qty_basecode(359))
   -- auxbox_prop_line("Lime Potions:", items:get_qty_basecode(357))
   -- auxbox_prop_line("Green Potions:", items:get_qty_basecode(353))
   -- auxbox_prop_line("Black Potions:", items:get_qty_basecode(352))
   -- auxbox_prop_line("Black Pearl:", items:get_qty_basecode(326))
   -- auxbox_prop_line("Garlic :", items:get_qty_basecode(328))
   -- auxbox_prop_line("Ginseng :", items:get_qty_basecode(329))
   -- auxbox_prop_line("Nightshade:", items:get_qty_basecode(331))
    -- auxbox_prop_line("Refined Scroll Health:", items:get_qty_basecode(323))
    -- auxbox_prop_line("Uncurse Scroll", items:get_qty_basecode(315))
   -- auxbox_prop_line("Unweld Scroll", items:get_qty_basecode(314))
   -- auxbox_prop_line("Grappling Hook", items:get_qty_basecode(313))
   -- auxbox_prop_line("Red Potion", items:get_qty_basecode(263))

end
]]
* Edited - more-readable scripts. Shift-X to reset the DPS information without resetting the entire auxbox. Shift-M to pause DPS info. Change these keybinds on lines 56-57.

* Update - fixed DF showing as 195. Fixed f-to-fire.
You do not have the required permissions to view the files attached to this post.
-Speed(COG) = [Grandmaster Stafffighter idk...]
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: Custom Auxbox Creations

Post by eggmceye »

what's the point of having bound item basecodes (in decimal) ?
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Custom Auxbox Creations

Post by speed »

Oh that might be an oversight; thought it was in hex.
I figured it be nice to have a 'currently equpiped equipment' section to fill in the space. And I figured I'd add in the base codes on the right, since why not!

It's also there so you can easily look up basecodes for items (equip any item in your main hand, look at the base code, and then add it to the coloured item list below).
-Speed(COG) = [Grandmaster Stafffighter idk...]
Post Reply