Completed Auxbox

Moderator: EUO Moderators

Post Reply
Azalynn
Good morning, Captain.
Posts: 312
Joined: Tue Mar 26, 2013 8:13 am

Completed Auxbox

Post by Azalynn »

As someone who does not understand code in the least, if someone has a fully completed auxbox or can direct one to a compilation of codes that would be awesome!
Regular
Thrall

PD
Thrall
Azalynn
Zyth
Tyrande
Azmodan
Elias
Az
Ass - LOTL
Zyth - LOTL
Zilverlight
Girls only want boyfriends who have great skills.
Posts: 704
Joined: Mon Sep 05, 2005 11:14 am

Re: Completed Auxbox

Post by Zilverlight »

Chedich wrote: viewtopic.php?f=3&t=4983 - Custom Auxbox Creations
viewtopic.php?f=3&t=5001 - Completed Auxbox Codes
These ought to give you options. There aren't very many instructions however on how exactly to do it. Those I found asking other players online that were more familiar with it than myself.
Desmond (AKA: Rurik)
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Completed Auxbox

Post by speed »

I'm going to be hijacking this thread to finally post my own auxbox, that I've been working on periodically for the past few years! I tried to make it as readable as possible, and it should be rather easy to know where to insert your own functions and stuff. However, it is probably put together really inefficiently, as I've never really looked at a single LUA tutorial in my life. That being said, it'd be nice if someone could look through it.

The main gimmick is that the auxbox was designed for the smallest resolution (800x600), so I only had 13 lines to work with.
Thus, I have multiple pages! Pressing shift-A and shift-Q cycle the auxbox forwards and backwards a page respectively (These can be easily changed if it interferes with keybinds). The five pages I have currently are Spells, XP, Item stock, Misc Info, and LordMortiferus' ASCII map, though adding a 6th page for a DPS counter shouldn't be too difficult. Of course, the ASCII map requires a higher resolution, since it can't be loaded in 13 lines, but it's still nice to have.

For those of you who want to stuff pages upon pages of extra information in your auxbox, hopefully the multiple pages will help. Now you can have enough space to catalog every single item in the game, if you wanted.
I spent way too much time making everything nice and colorful.

Code: Select all

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

shiftkeys = {"Shift","Alt","Ctrl+Shift","Shift+Alt","Ctrl+Alt","CtrlAltShift"}
filterTextLines=[[{47F}Filters:    Search with /{FFF}
w: weapons  W: wearables
s: shields  j: jewellry
S: scrolls  U: unidentified
p: potions  R: reagents
u: usable   f: food
G: gems  r: ring  n: neck
h: head  t: body  l: legs 
b: feet  g: hand  a: ammo
v: cancel filtering]]
auxbox_next_line = 0     --
session_time = 0         --
sessionstart = os.time() --
current_slide = 0

--[[ Modifiable Variables (Feel free to change these) ]]

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)
default_slide = 2 -- Initial auxbox slide on startup
number_of_slides = 5 -- Change this if you wish to add a slide

------------------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[AUXBOX SETUP]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------------------

--[[ Auxbox startup and menu slides ]]
function auxbox()
  local w=d:auxbox_get_width()
  local h=d:auxbox_get_height()

  d:auxbox_clear()
  auxbox_next_line = 0 
  
  if not d:ok_to_draw_play_window() then return; end
      
  local cd=d:get_curr_display()
  local mode=d:get_statbox_mode()
  local lineNr=0
  local txta=explode("\n", filterTextLines)

  if cd==1 then 
    if mode==SELECT_ABILITY then
    	auxbox_prop_line("Hit F-key to bind")
    	auxbox_blank_line()
    	auxbox_ability_binds()
    else
	  	for i=1,#txta do
	  	  auxbox_prop_line(txta[i])
	  	end
	  	if mode==SELECT_READY then
        auxbox_blank_line()
	  		auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to equip")
	    elseif mode==SELECT_BUY then  		
        auxbox_blank_line()
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to buy")
	    elseif mode==SELECT_BANK then
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to transfer one")
	    	auxbox_prop_line("Press {6F7}Shift+ENTER{47F}   for ten")
	    	auxbox_prop_line("Press {6F7}TAB{47F}   for whole stack")
	    end
	  end

---------------------------------------------------------------------------
--[[ Auxbox silde 1 = Spells and Abilities ]]
  elseif current_slide == 0 then
    auxbox_time() -- Real World / Session Time

    auxbox_prop_line("{FFF}")
    local cnt=auxbox_ability_binds()
    if cnt==0 then 
      auxbox_prop_line("None!")
      auxbox_blank_line()
      auxbox_prop_line("Hit shift-c then F keys")
      auxbox_prop_line("to bind.") 
    end
    auxbox_blank_line()
    auxbox_blank_line()
    auxbox_go_to_line("{47F}01) Spell and Ability Binds", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)
    
    auxbox_slides()

---------------------------------------------------------------------------
--[[ Auxbox slide 2 = XP ]]
  elseif current_slide == 1 then
   	auxbox_time()	-- Real World / Session Time

    auxbox_prop_line("{6F7}")
    ched_xp_init()
   	auxbox_ched_xppmin() -- Level / Current XP / XP to next level / Last XP gain

    auxbox_blank_line()
    auxbox_go_to_line("{47F}02) Experience Information", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)
	  
    auxbox_slides()

---------------------------------------------------------------------------
--[[ Auxbox slide 3 = Item stock ]]
  elseif current_slide == 2 then
    auxbox_time() -- Real World / Session Time

    auxbox_blank_line()
    item_color_indicator(0x16b, 30) --If you add an item here, you must define it in the function, item_color_indicator
    item_color_indicator(0x16c, 30)
    auxbox_blank_line()
    item_color_indicator(0x177, 100)
    item_color_indicator(0x41d, 50)
    item_color_indicator(0x12b, 50)
    item_color_indicator(0x521, 10)

    auxbox_blank_line()
    auxbox_go_to_line("{47F}03) Item Count Information", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)
    
    auxbox_slides()

---------------------------------------------------------------------------
--[[ Auxbox slide 4 = Extra Statistics ]]
  elseif current_slide == 3 then
    auxbox_time() -- Real World / Session Time

    auxbox_blank_line()
    auxbox_prop_line("{47F}HP: {6F7}"..me:get_hp_max().." {47F}MP: {6F7}"..me:get_mana_max(),"{47F}MR: {6F7}"..me:get_magic_resistance())
    auxbox_prop_line("{47F}Str: {6F7}"..me:get_str().." {47F}Dex: {6F7}"..me:get_dex().." {47F}Int: {6F7}"..me:get_intel())
    character_age()
    auxbox_blank_line()

    auxbox_prop_line("{47F}Weapon Skill: {FFF}"..wl:get_wep_skill_name(me.weapon))
    auxbox_prop_line("{47F}Weapon Type : {FFF}"..wl:get_wep_dmg_str(me.weapon))
    auxbox_prop_line("{47F}Weapon Level: {FFF}"..wl:get_min_id_skill(me.weapon).."/100")

    --Test Variables: (You can probably remove these)
    --testing = wl:is_artifact(me.weapon)
    --testing = wl:get_wep_skill_name(me.weapon)
    --testing = wl:get_wep_dmg_str(me.weapon)
    --testing = wl:is_legit(me.ring1)
    --testing = ml:is_aquatic(210)
    --testing = wl:is_wearable(me.weapon)
    --testing = spells:get_full_spell_name(21)
    --testing = nil
    --auxbox_prop_line(tostring(testing))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.weapon))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.shield))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.ring1))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.ring2))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.amulet))    

    auxbox_blank_line()
    auxbox_prop_line("Forums: forums.swut.net")
    auxbox_prop_line("Manual: euotopia.com/manual")
    if d:numlock() then
      auxbox_prop_line("{FFF}Please turn numlock off!{47F}")
    else
      auxbox_blank_line()
    end
    auxbox_blank_line()
    auxbox_go_to_line("{47F}04) Stats and Weapon Info", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)

    auxbox_slides()

---------------------------------------------------------------------------
--[[ Auxbox slide 5 = LordMortiferus' ASCII MAP (requires higher resolution) ]]
  
  elseif current_slide == 4 then
    
    if h >= 24 then
      auxbox_prop_line(auxbox_lm_ascii_map())
      auxbox_blank_line()
    else
      auxbox_prop_line("Cannot load ASCII Map")
      auxbox_prop_line("Please Increase Resolution")
      auxbox_blank_line()
    end

    auxbox_go_to_line("{47F}05) ASCII Map", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)

    auxbox_slides()

---------------------------------------------------------------------------
  --Add an elseif statement to insert slide 6 here
---------------------------------------------------------------------------
--[[ Auxbox Missing Slide (If you see this, lower your number_of_slides variable) ]]

  else               --
    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("Please set number_of_slides")
    auxbox_prop_line("to a lower value.")
    auxbox_go_to_line("??) Missing Page", nil, h - 2)
    auxbox_go_to_line("<- {4BB}Shift-Q       Shift-A{47F} ->", nil, h - 1)
    
    auxbox_slides()
  end

end

-----------------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[FUNCTIONS]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--
-----------------------------------------------------------------------------------------

--[[ Blank line ]]

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 ]]

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

--[[ Go To Line - Speed (Use this to jump to write something on a specific line, and override what would be under it) ]]

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(" ", 25 - string.len(prop_name) - string.len(prop_val))
  auxbox_next_line = auxbox_next_line + 1
  d:auxbox_set_line(go_to_line, string.format("%s %s %s", prop_name, filler, prop_val))
end

--[[ Insert line with extra filler - Speed (This is to counteract color tags taking up space, sorta hacked together) ]]

prop_extra_filler = 0
function auxbox_prop_extra_filler(prop_name, prop_val, prop_extra_filler)
  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) + prop_extra_filler)
  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 to round numbers, idp is the decimal place ]]

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

---------------------------------------------------------------------------
--[[ Explode ]]
-- from http://lua-users.org/wiki/SplitJoin

function explode(d,p) -- explode(seperator, string)
  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's left in our array.
        break -- Break at end, as it should be, according to the lua manual.
      end
    end
  return t
end

---------------------------------------------------------------------------
--[[ Gets spell names ]]

function auxbox_ability_binds() 
  local cnt=0     
  for i=10,15 do
    if me.spell_binds[i]~=-1 then
     auxbox_prop_line(shiftkeys[i-9],spells:get_full_spell_name(me.spell_binds[i]))
     cnt=cnt+1
    end
  end
  return cnt
end

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

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

---------------------------------------------------------------------------
--[[ Automaticly compiled client script for EUO ]]
-- Containing:
-- XP/min by Chedich
-- XP by LordMortiferus 2013/01/28, rehashed by Brentoboy
-- Edited by Speed, so not all of the features still work! I removed parts of the original code, so feel free to replace it with the original.

req_xp = {} -- beginning of XP-array
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 -- end of XP-array

ched_init=true
ched_xp_arr={}

function ched_xp_init()
   if ched_init then
      if current_level <= 1000 then
         xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level])
       end
      ched_xp=me.xp
      ched_currentlvl=me.lvl-(me.remort_level*75)
      ched_lastxp=0
      ched_sessionxp = 0  -- Added by Speed
      ched_xp_next_level = 0
      ched_lasttick = 0
      ched_lastname=me.name
      ched_init=false

      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

      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_sessionxp = ched_sessionxp + ched_lastxp
      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

      ched_exact_level = ched_currentlvl + (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl] - ched_xp_next_level) / (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl])
      ched_rounded_exact_level = round(ched_exact_level, 5)
   end
   
   auxbox_prop_line("Current Level:", string.format(ched_rounded_exact_level))
   auxbox_prop_line("Current XP:", string.format("%d", me.xp))
   auxbox_prop_line(string.format("XP for level "..string.format(ched_currentlvl + 1)..":"), req_xp[(ched_currentlvl+1)] - req_xp[(ched_currentlvl)])
   auxbox_prop_line("XP to next level:", ched_xp_next_level)
   auxbox_blank_line()
   auxbox_prop_extra_filler("{AAA}Session XP gain:{BBB}", ched_sessionxp, 9)
   auxbox_prop_extra_filler("{AAA}Last XP gain:{FFF}", ched_lastxp, 9)
end

---------------------------------------------------------------------------
--[[ 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

---------------------------------------------------------------------------
--[[ Item stock color display - Speed ]]

function item_color_indicator(item_code, amt_item)
  color_percent = items:get_qty_basecode(item_code) * 16 / amt_item
  local color_red= round((16 - color_percent) * 2)
  if color_red== 10 then color_red= "A"
  elseif color_red < 0 then color_red = 0
  elseif color_red == 11 then color_red= "B"
  elseif color_red == 12 then color_red= "C"
  elseif color_red == 13 then color_red= "D"
  elseif color_red == 14 then color_red= "E"
  elseif color_red == 15 then color_red= "F"
  elseif color_red > 15 then color_red= "F" end
  local color_green = round((2 * color_percent))
  if color_green == 10 then color_green = "A"
  elseif color_green < 0 then color_green = 0
  elseif color_green == 11 then color_green = "B"
  elseif color_green == 12 then color_green = "C"
  elseif color_green == 13 then color_green = "D"
  elseif color_green == 14 then color_green = "E"
  elseif color_green == 15 then color_green = "F"
  elseif color_green > 15 then color_green = "F" end

  item_color = ("{"..tostring(color_red)..tostring(color_green).."0}"..items:get_qty_basecode(item_code))

  if item_code == 0x16b then --List of known items, to add an item provide the item code
    auxbox_prop_line("{FFF}Mega Yellow Potions:", item_color.."/"..amt_item)
  elseif item_code == 0x16c then
    auxbox_prop_line("{FFF}Mega Blue Potions:  ", item_color.."/"..amt_item)
  elseif item_code == 0x177 then
    auxbox_prop_line("{FFF}Bandages:         ", item_color.."/"..amt_item)
  elseif item_code == 0x41d then
    auxbox_prop_line("{FFF}Blank Scrolls:      ", item_color.."/"..amt_item)
  elseif item_code == 0x12b then
    auxbox_prop_line("{FFF}Bread:              ", item_color.."/"..amt_item)
  elseif item_code == 0x521 then
    auxbox_prop_line("{FFF}Skull Keys:         ", item_color.."/"..amt_item)
  else
    auxbox_prop_line("{F66}Item            " .. item_code .. ":", item_color.."/"..amt_item)
  end
end

---------------------------------------------------------------------------
--[[ Auxbox slides - Speed ]]

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

function auxbox_keypressed(key,ch,scancode)
 gch=ch
end

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

function auxbox_lm_ascii_map()
  local asciimap = {}
  local tilexy = 0
  
  -- scan of xy-cords around player
  sx=me.x-10
  ex=me.x+10
  sy=me.y-10
  ey=me.y+10
    
   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}~")
         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}~")
         elseif (cmap:is_void(xx,yy)) then
          table.insert (asciimap,tilexy,"{000} ")
         elseif (cmap:is_wet(xx,yy)) then
          table.insert (asciimap,tilexy,"{05f}~")
         elseif tiledata:is_blocking(cmap:get_tile(xx,yy))==true then
          table.insert (asciimap,tilexy,"{bbb}A")
         else
          table.insert (asciimap,tilexy,"{0f0}.") -- for anything that is not defined above but can be seen
         end
      end

        if tilexy == 21 then
       tilexy = 0
            if yy == sy or yy == ey then
               table.insert (asciimap,22," {fff}-10")
          elseif yy == sy+5 or yy == sy+15 then
           table.insert (asciimap,22," {fff}-5 ")
         elseif yy == sy+10 then
          table.insert (asciimap,22," {fff}-0 ")
          else
          table.insert (asciimap,22,"    ")
         end      
         auxbox_prop_line("", string.format("%s", table.concat(asciimap)))
          for i,v in pairs(asciimap) do
             asciimap[i]=nil
           end
      end
   end
  
  auxbox_blank_line()
  auxbox_prop_line("","{fff}|    |    |    |    |    ")
  auxbox_prop_line("","{fff}10   5    0    5    10   ")
end
You do not have the required permissions to view the files attached to this post.
-Speed(COG) = [Grandmaster Stafffighter idk...]
Azalynn
Good morning, Captain.
Posts: 312
Joined: Tue Mar 26, 2013 8:13 am

Re: Completed Auxbox

Post by Azalynn »

Absolutely love it. This is exactly what I asked for. Anyone else have completed once? Just getting a pool ans hopefully finding one that is useful to me on all chtacters!
Regular
Thrall

PD
Thrall
Azalynn
Zyth
Tyrande
Azmodan
Elias
Az
Ass - LOTL
Zyth - LOTL
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: Completed Auxbox

Post by eggmceye »

it's amazing - I haven't looked at the code, do you want an actual 'code review'? as if i was your supervisor or something LAUGHING OUT LOUD LIKE A MORON
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: Completed Auxbox

Post by eggmceye »

I was annoyed how when you are chatting, and hit capital A, the auxbox page flipped, so with the latest client patch released now (1.3.37) key strokes are ignored by auxbox when chatting (and other things)

auxbox needs a small patch :

where it says

Code: Select all

function auxbox_keypressed(key,ch,scancode)
 gch=ch
end
replace with

Code: Select all

function auxbox_keypressed(key,ch,scancode)
 if gc_interface_mode==NORMAL then gch=ch end
end
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Completed Auxbox

Post by speed »

Thanks XD!
I have limited coding experience, and had a bunch of trouble trying to find out the names of the functions I wanted to use, so small QOL updates like this are greatly appreciated!

I'd still like to make a counter that tracks the # of monsters you've killed within the auxbox (i.e. "red dragon: 300" would appear if you've killed 300 red dragons). The old charts on the armoury pages that were removed due to lag reasons (iirc?), but I'm curious as to whether or not the stats for creature kills are still being tracked.
-Speed(COG) = [Grandmaster Stafffighter idk...]
User avatar
eggmceye
hello
Posts: 10577
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia
Contact:

Re: Completed Auxbox

Post by eggmceye »

speed wrote: Fri Jan 10, 2020 7:26 am
I have limited coding experience, and had a bunch of trouble trying to find out the names of the functions I wanted to use, so small QOL updates like this are greatly appreciated!
the client actually needed a patch to add gc_interface_mode to the api - so nothing for you to do (or have done)!

the old mob kill totals were removed because it was causing lag, due to probably crappy database design
I could revisit it one day, as I've done a fuckload more database design at work since 10 yrs ago when I put that feature in (and removed it)
Onyxt
Girls only want boyfriends who have great skills.
Posts: 715
Joined: Wed Dec 13, 2006 11:54 am

Re: Completed Auxbox

Post by Onyxt »

eggmceye wrote: Fri Jan 10, 2020 8:53 am
speed wrote: Fri Jan 10, 2020 7:26 am
I have limited coding experience, and had a bunch of trouble trying to find out the names of the functions I wanted to use, so small QOL updates like this are greatly appreciated!
the client actually needed a patch to add gc_interface_mode to the api - so nothing for you to do (or have done)!

the old mob kill totals were removed because it was causing lag, due to probably crappy database design
I could revisit it one day, as I've done a fuckload more database design at work since 10 yrs ago when I put that feature in (and removed it)
It'd be cool if you could login to the armoury and see those stats again. I liked being able to see how many ettins I slaughtered while hunting treasure maps back then.
Kharan
Hey I just posted on an internet forum!
Posts: 1
Joined: Sun Feb 14, 2021 2:55 pm

Re: Completed Auxbox

Post by Kharan »

When i reached lvl 1000, this auxbox crashed.
Its work again after tweak:

for i=27,1000 do -- adds XP for lvl 27 to 1000 to array
changed to:
for i=27,1100 do -- adds XP for lvl 27 to 1000 to array

i change it again to
for i=27,1022 do -- adds XP for lvl 27 to 1000 to array
because 2G exp is game limit (calculating to lvl 1021)
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Completed Auxbox

Post by speed »

Happy holidays! It's been a while since I updated the multi-page auxbox. Here are the updates:

* Can easily toggle pages on and off by commenting out pages from the list (LUA comments are '--'; see the first image below):
* Can easily change out the items on page 3 (Just look up item codes in MAPED, or ready the item in your main hand (see below))
* Added a coloured hunger meter on page 4 (Although some of the values may not be exact)
* Added a page on weapon information on page 5 (can see the item code (as long as it's not too complex) of any readied weapon)
* Added and modified LordMortiferus' ASCII map on page 6 to work for any window resolution
* Added Kharan's level 1022 tweak to the xp table

To update the auxbox, replace the code in clientscripts > auxbox.lua with the following code:

Code: Select all

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

--[[ Modifiable Variables (Feel free to change these) ]]

slides_list = { -- Comment out lines to ignore slides
  --"Auxbox Testing",
  "Spell and Ability Binds",
  "Experience Information",
  "Item Count Information",
  "Additional Stats",
  "Current Weapon Info",
  "ASCII Map"
}
default_slide = 2 -- 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)

--[[ Other Variables ]]

shift_keys = {"Shift","Alt","Ctrl Shift","Shift Alt","Ctrl Alt","Ctrl Alt Shift"}
filter_text_lines=
[[{47F}Filters:    Search with /{FFF}
w: weapons  W: wearables
s: shields  j: jewellry
S: scrolls  U: unidentified
p: potions  R: reagents
u: usable   f: food
G: gems  r: ring  n: neck
h: head  t: body  l: legs 
b: feet  g: hand  a: ammo
v: cancel filtering]]

session_time = 0
sessionstart = os.time()
current_slide = 0
number_of_slides = #slides_list

------------------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[AUXBOX SETUP]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]
------------------------------------------------------------------------------------------

--[[ Auxbox startup ]]

function auxbox()
  local w=d:auxbox_get_width()
  local h=d:auxbox_get_height()
  auxbox_text_width = 27 -- Seems to be constant for all resolutions

  d:auxbox_clear()
  auxbox_next_line = 0 
  
  if not d:ok_to_draw_play_window() then return; end
      
  local cd=d:get_curr_display()
  local mode=d:get_statbox_mode()
  local lineNr=0
  local txta=explode("\n", filter_text_lines)

---------------------------------------------------------------------------
--[[ Menu Slides (for filtering, spells, and merchant windows) ]]

  if cd==1 then 
    if mode==SELECT_ABILITY then
    	auxbox_prop_line("Hit F-key to bind")
    	auxbox_blank_line()
    	auxbox_ability_binds()
    else
	  	for i=1,#txta do
	  	  auxbox_prop_line(txta[i])
	  	end
	  	if mode==SELECT_READY then
        auxbox_blank_line()
	  		auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to equip")
	    elseif mode==SELECT_BUY then  		
        auxbox_blank_line()
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to buy")
	    elseif mode==SELECT_BANK then
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to transfer one")
	    	auxbox_prop_line("Press {6F7}Shift+ENTER{47F}   for ten")
	    	auxbox_prop_line("Press {6F7}TAB{47F}   for whole stack")
	    end
	  end

---------------------------------------------------------------------------
--[[ Script Testing ]]

  elseif slides_list[current_slide+1] == "Auxbox Testing" then

    auxbox_prop_line(me:get_num_spells())
    auxbox_prop_line(spells:get_num_spells())

    --auxbox_prop_line(sc:get_skillname(43))
    --auxbox_prop_line(sc:max_skills())

    auxbox_prop_line(string.format("%x", me.weapon:intVal()))
    auxbox_prop_line(string.format("%x", get_base_code(me.weapon)))
    auxbox_prop_line(string.format("%x", get_material(me.weapon)))
    auxbox_prop_line(string.format("%x", get_tile_num(me.weapon)))
    --auxbox_prop_line(string.format("%x", ))

    --auxbox_prop_line(spells:get_spell_id("vf"))
    --auxbox_prop_line(spells:get_parameters(132))
    --auxbox_prop_line(spells:get_full_spell_name(122))

    --auxbox_prop_line(items:get_qty(me.ring1))
    --auxbox_prop_line(get_tile_num(me.weapon))
    --auxbox_prop_line(string.len(test_str))
    --auxbox_prop_line(wl:get_name(Item(0x16b)), test_len)
    --auxbox_prop_line(Item.str(me.ring1))
    --auxbox_prop_line(shiftkeys[5], spells:get_full_spell_name(me.spell_binds[14]))
    --auxbox_prop_line(wl:get_full_name(me.sigil1))
    --auxbox_prop_line(wl:get_speed(me.weapon))

    --testing = wl:is_artifact(me.weapon)
    --testing = wl:get_wep_skill_name(me.weapon)
    --testing = wl:get_wep_dmg_str(me.weapon)
    --testing = wl:is_legit(me.ring1)
    --testing = ml:is_aquatic(210)
    --testing = wl:is_wearable(me.weapon)
    --testing = spells:get_full_spell_name(21)
    --testing = nil
    --auxbox_prop_line(tostring(testing))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.weapon))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.shield))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.ring1))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.ring2))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.amulet))

---------------------------------------------------------------------------
--[[ Spells and Abilities ]]

  elseif slides_list[current_slide+1] == "Spell and Ability Binds" then
    auxbox_time()
    auxbox_prop_line("{FFF}")
    local cnt=auxbox_ability_binds()
    if cnt==0 then 
      auxbox_prop_line("No spells/abilities bound!")
      auxbox_blank_line()
      auxbox_prop_line("Hit shift-c, then F keys")
      auxbox_prop_line("to bind.") 
    end

---------------------------------------------------------------------------
--[[ XP ]]

  elseif slides_list[current_slide+1] == "Experience Information" then
   	auxbox_time()
    auxbox_prop_line("{6F7}")
    ched_xp_init()
   	auxbox_ched_xppmin() -- Level / Current XP / XP to next level / Last XP gain

---------------------------------------------------------------------------
--[[ Item stock ]]

  elseif slides_list[current_slide+1] == "Item Count Information" then
    auxbox_time()

    auxbox_prop_line("{FFF}")

    item_color_indicator(0x3f0104, 30, true)
    item_color_indicator(0x105, 30, true)
    item_color_indicator(0x161, 30, true)
    item_color_indicator(0x177, 100, true)
    item_color_indicator(0x41d, 50, true)
    item_color_indicator(0x12b, 50, true)
    item_color_indicator(0x577, 30, true)

---------------------------------------------------------------------------
--[[ Extra Statistics ]]

  elseif slides_list[current_slide+1] == "Additional Stats" then
    auxbox_time()

    auxbox_blank_line()
    --auxbox_prop_line("{47F}HP: {6F7}"..me:get_hp_max().." {47F}MP: {6F7}"..me:get_mana_max(),"{47F}MR: {6F7}"..me:get_magic_resistance())
    --auxbox_prop_line("{47F}Str: {6F7}"..me:get_str().." {47F}Dex: {6F7}"..me:get_dex().." {47F}Int: {6F7}"..me:get_intel())
    character_age()

    auxbox_blank_line()
    auxbox_prop_line("{47F}Map : {FFF}"..cmap:get_level().." {BBB}("..cmap:get_max_x().."x"..cmap:get_max_y()..")")
    auxbox_prop_line("{47F}Tile: {BBB}"..tiledata:get_desc(cmap:get_tile(me.x, me.y)))
    
    auxbox_blank_line()
    auxbox_hunger_bar()

    auxbox_blank_line()
    --auxbox_prop_line("{BBB}Forums: forums.swut.net")
    --auxbox_prop_line("Manual: euotopia.com/manual")
    if d:numlock() then
      auxbox_prop_line("{FFF}Please turn numlock off!{47F}")
    else
      auxbox_blank_line()
    end

---------------------------------------------------------------------------
--[[ Weapon Info ]]

  elseif slides_list[current_slide+1] == "Current Weapon Info" then
    auxbox_time()

    auxbox_blank_line()
    auxbox_prop_line("{47F}Current Weapon and Shield:")
    auxbox_prop_line_wrap("{B7F}"..wl:get_full_name(me.weapon), "{7FB}"..string.format("%x", me.weapon:intVal())) -- Hex code for the item wielded in the main hand
    auxbox_prop_line_wrap("{F7B}"..wl:get_full_name(me.shield), "{7FB}"..string.format("%x", me.shield:intVal()))

    auxbox_prop_line("{79F}Main: {FFF}"..wl:get_wep_skill_name(me.weapon)..", "..wl:get_wep_dmg_str(me.weapon))

    if (wl:is_weapon(me.shield)) then -- dual wielding
      auxbox_prop_line("{79F}Off : {FFF}"..wl:get_wep_skill_name(me.shield)..", "..wl:get_wep_dmg_str(me.shield))
    else
      auxbox_prop_line("{79F}Speed: {6F7}"..me:get_weapon_delay().."   ".."{79F}Dice: {6F7}"..me:get_dmg_dice().."d"..me:get_dmg_sides())
    end    
    
    --auxbox_prop_line("{79F}Stat Multiplier: {FFF}"..string.format("%.4f", me:stat_damage_multiplier()))

---------------------------------------------------------------------------
--[[ LordMortiferus' ASCII MAP (requires higher resolution) ]]
  
  elseif slides_list[current_slide+1] == "ASCII Map" then

    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

---------------------------------------------------------------------------
  --Add an elseif statement to insert slide 6 here
---------------------------------------------------------------------------
--[[ Missing Slide (If you see this, lower your number_of_slides variable) ]]

  else
    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

  if d:numlock() then
    auxbox_go_to_line("{F00}---------------------------", nil, h-2)
    auxbox_go_to_line("{F00} Please turn numlock off!", nil, h-1)

  elseif cd ~= 1 then
    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)
  end
  auxbox_slides()
end







-----------------------------------------------------------------------------------------
--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[FUNCTIONS]]--[[]]--[[]]--[[]]--[[]]--[[]]--[[]]--
-----------------------------------------------------------------------------------------

--[[ Blank line ]]

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 ]]

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)
  num_color_codes = 0 -- Need to keep track of the # of color codes in prop_name, to account for them when taking the substr
  for find_color_codes in string.gfind(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.gfind(prop_val, "{%w%w%w}") do prop_val_len = prop_val_len - 5 end

  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)
    auxbox_next_line = auxbox_next_line + 1
    d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
  else
    auxbox_next_line = auxbox_next_line + 1
    if prop_val=="" then
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, auxbox_text_width-prop_val_len+num_color_codes*5))
    else
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, auxbox_text_width-1-prop_val_len+num_color_codes*5).." "..prop_val)
    end
  end
end

-- [[ Insert line with word wrap ]]

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

--[[ Go To Line - Speed (Use this to jump to write something on a specific line, and override what would be under it) ]]

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

---------------------------------------------------------------------------
--[[ Function to round numbers, idp is the decimal place ]]

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

---------------------------------------------------------------------------
--[[ Explode ]]
-- from http://lua-users.org/wiki/SplitJoin

function explode(d,p) -- explode(seperator, string)
  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's left in our array.
        break -- Break at end, as it should be, according to the lua manual.
      end
    end
  return t
end

---------------------------------------------------------------------------
--[[ Gets spell names ]]

function auxbox_ability_binds() 
  local cnt=0     
  for i=10,15 do
    if me.spell_binds[i]~=-1 then
     auxbox_prop_line(shift_keys[i-9], spells:get_full_spell_name(me.spell_binds[i]))
     cnt=cnt+1
    end
  end
  return cnt
end

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

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)
    --session_h_float = session_time / 60 / 60
    --session_h = math.floor(session_h_float)
    --session_m = math.floor((session_h_float - session_h) * 60)
    --session_s = math.floor(((session_h_float - 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)) 
     --auxbox_prop_line("{47F}Session Time:", "{FFF}"..string.format("%02.f:%02.f:%02.f", session_h, session_m, session_s)) 
   end 
end

---------------------------------------------------------------------------
--[[ Automaticly compiled client script for EUO ]]
-- Containing:
-- XP/min by Chedich
-- XP by LordMortiferus 2013/01/28, rehashed by Brentoboy
-- Edited by Speed, so not all of the features still work! I removed parts of the original code, so feel free to replace it with the original.

req_xp = {} -- beginning of XP-array
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 1022 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 -- end of XP-array

ched_init=true
ched_xp_arr={}

function ched_xp_init()
   if ched_init then
      if current_level <= 1000 then
         xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level])
       end
      ched_xp=me.xp
      ched_currentlvl=me.lvl-(me.remort_level*75)
      ched_lastxp=0
      ched_sessionxp = 0  -- Added by Speed
      ched_xp_next_level = 0
      ched_lasttick = 0
      ched_lastname=me.name
      ched_init=false

      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

      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_sessionxp = ched_sessionxp + ched_lastxp
      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

      ched_exact_level = ched_currentlvl + (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl] - ched_xp_next_level) / (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl])
      ched_rounded_exact_level = round(ched_exact_level, 5)
   end
   
   auxbox_prop_line("Current Level:", string.format(ched_rounded_exact_level))
   auxbox_prop_line("Current XP:", string.format("%d", me.xp))
   auxbox_prop_line(string.format("XP for level "..string.format(ched_currentlvl + 1)..":"), req_xp[(ched_currentlvl+1)] - req_xp[(ched_currentlvl)])
   auxbox_prop_line("XP to next level:", ched_xp_next_level)
   auxbox_blank_line()
   auxbox_prop_line("{AAA}Session XP gain:", "{BBB}"..ched_sessionxp.." ")
   auxbox_prop_line("{AAA}Last XP gain:", "{FFF}"..ched_lastxp.." ")
end

---------------------------------------------------------------------------
--[[ 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

---------------------------------------------------------------------------
--[[ Item stock color display - Speed ]]

function item_color_indicator(item_code, max_amt_item, show_max)
  --local item_amount = items:get_qty_basecode(item_code) -- this version of item_amount does not count for tints/enchants
  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
  local item_name = wl:get_full_name(Item(item_code))
  auxbox_prop_line("{FFF}"..item_name:gsub("^%l", string.upper), item_color_full)

end

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

function auxbox_hunger_bar()

  --auxbox_prop_line("{47F}Hunger: {FFF}"..me.hunger)

  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

---------------------------------------------------------------------------
--[[ Auxbox slides - Speed ]]

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

function auxbox_keypressed(key,ch,scancode)
 if gc_interface_mode==NORMAL then gch=ch end
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
      --[[
      if yy == sy or yy == ey then
        table.insert (asciimap,22," {fff}-10")
      elseif yy == sy+5 or yy == sy+15 then
        table.insert (asciimap,22," {fff}-5 ")
      elseif yy == sy+10 then
        table.insert (asciimap,22," {fff}-0 ")
      else
        table.insert (asciimap,22,"    ")
      end 
      --]]     
      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
You do not have the required permissions to view the files attached to this post.
-Speed(COG) = [Grandmaster Stafffighter idk...]
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Completed Auxbox

Post by speed »

Here's the multi-paged, coloured, customizable auxbox that I showed on Discord a few months back. Just updated it to work with 6-digit hex color codes from the most recent EUO update! By default, this auxbox was made for the smallest display resolution (800x600) since that's what I play in. However, it's pretty easy to edit to suit your own needs.

For basic customization, check the first section [DEFINING VARIABLES] in the code; you can comment out entire pages if you don't plan on using them. It's also pretty easy to define the default slide that you start with, and any relevant keybinds.

For slightly more involved customization, feel free to move functions around in the second section [PAGE SELECT]. It also shouldn't be too hard to add your own functions, and call add them to whichever pages you want them in.


If you only want the color code functionality, feel free to copy-paste the "auxbox_prop_line" function, and replace the version of the function in your own auxbox.

Code: Select all

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

--[[ Modifiable Variables (Feel free to change these) ]]

slides_list = { -- Comment out lines to ignore slides
  --"Auxbox Testing",
  "Spell and Ability Binds",
  "Experience Information",
  "Item Count Information",
  "Additional Stats",
  "Damage Per Second Info",
  "Current Weapon Info",
  "Instances",
  "ASCII Map"
}
default_slide = 1 -- Initial auxbox slide on startup

next_slide = 65 -- (A) ASCII for the key required to cycle slides forwards (increases slide_counter by 1)
prev_slide = 81 -- (Q) 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

----------------------------------------------------------------------------------------------------------------
--[[ Other Variables ]]

shift_keys = {"Shift","Alt","Ctrl Shift","Shift Alt","Ctrl Alt","Ctrl Alt Shift"}
filter_text_lines=
[[{47F}Filters:    Search with /{FFF}
w: weapons  W: wearables
s: shields  j: jewellry
S: scrolls  U: unidentified
p: potions  R: reagents
u: usable   f: food
G: gems  r: ring  n: neck
h: head  t: body  l: legs 
b: feet  g: hand  a: ammo
v: cancel filtering]]

session_time = 0
sessionstart = os.time()
current_slide = 0
number_of_slides = #slides_list

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

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",
   [299] = "Sagittarius"
}

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

function auxbox()
  -- Important variables that are defined each update cycle
  local w=d:auxbox_get_width()
  local h=d:auxbox_get_height()
  auxbox_text_width = 27 -- Seems to be constant for all resolutions
  d:auxbox_clear()
  auxbox_next_line = 0 
  
  if not d:ok_to_draw_play_window() then return; end
      
  local cd=d:get_curr_display()
  local mode=d:get_statbox_mode()
  local lineNr=0
  local txta=explode("\n", filter_text_lines)

  -- These functions run regardless of the current slide
  auxbox_lm_dpscalc()
  auxbox_lm_dynamic_instance_reset()
  check_pause_lm_dpscalc()
  check_reset_lm_dpscalc()

---------------------------------------------------------------------------------------[[ General Menu Slides ]]

  if cd==1 then 
    if mode==SELECT_ABILITY then
    	auxbox_prop_line("Hit F-key to bind")
    	auxbox_blank_line()
    	auxbox_ability_binds()
    else
	  	for i=1,#txta do
	  	  auxbox_prop_line(txta[i])
	  	end
	  	if mode==SELECT_READY then
        auxbox_blank_line()
	  		auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to equip")
	    elseif mode==SELECT_BUY then  		
        auxbox_blank_line()
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to buy")
	    elseif mode==SELECT_BANK then
	    	auxbox_prop_line("{47F}Press {6F7}ENTER{47F} to transfer one")
	    	auxbox_prop_line("Press {6F7}Shift+ENTER{47F}   for ten")
	    	auxbox_prop_line("Press {6F7}TAB{47F}   for whole stack")
	    end
	  end

--------------------------------------------------------------------------------------------[[ Script Testing ]]

  elseif slides_list[current_slide+1] == "Auxbox Testing" then

    auxbox_prop_line(me:get_num_spells())
    auxbox_prop_line(spells:get_num_spells())

    --auxbox_prop_line(sc:get_skillname(43))
    --auxbox_prop_line(sc:max_skills())

    auxbox_prop_line(string.format("%x", me.weapon:intVal()))
    auxbox_prop_line(string.format("%x", get_base_code(me.weapon)))
    auxbox_prop_line(string.format("%x", get_material(me.weapon)))
    auxbox_prop_line(string.format("%x", get_tile_num(me.weapon)))
    --auxbox_prop_line(string.format("%x", ))

    --auxbox_prop_line(spells:get_spell_id("vf"))
    --auxbox_prop_line(spells:get_parameters(132))
    --auxbox_prop_line(spells:get_full_spell_name(122))

    --auxbox_prop_line(items:get_qty(me.ring1))
    --auxbox_prop_line(get_tile_num(me.weapon))
    --auxbox_prop_line(string.len(test_str))
    --auxbox_prop_line(wl:get_name(Item(0x16b)), test_len)
    --auxbox_prop_line(Item.str(me.ring1))
    --auxbox_prop_line(shiftkeys[5], spells:get_full_spell_name(me.spell_binds[14]))
    --auxbox_prop_line(wl:get_full_name(me.sigil1))
    --auxbox_prop_line(wl:get_speed(me.weapon))

    --testing = wl:is_artifact(me.weapon)
    --testing = wl:get_wep_skill_name(me.weapon)
    --testing = wl:get_wep_dmg_str(me.weapon)
    --testing = wl:is_legit(me.ring1)
    --testing = ml:is_aquatic(210)
    --testing = wl:is_wearable(me.weapon)
    --testing = spells:get_full_spell_name(21)
    --testing = nil
    --auxbox_prop_line(tostring(testing))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.weapon))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.shield))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.ring1))
    --auxbox_prop_line("{9BF}"..wl:get_full_name(me.ring2))
    --auxbox_prop_line("{7FF}"..wl:get_full_name(me.amulet))

--------------------------------------------------------------------------------------[[ Spells and Abilities ]]

  elseif slides_list[current_slide+1] == "Spell and Ability Binds" then
    auxbox_time()
    auxbox_prop_line("{FFF}")
    local cnt=auxbox_ability_binds()
    if cnt==0 then 
      auxbox_prop_line("No spells/abilities bound!")
      auxbox_blank_line()
      auxbox_prop_line("Hit shift-c, then F keys")
      auxbox_prop_line("to bind.") 
    end

--------------------------------------------------------------------------------------------------------[[ XP ]]

  elseif slides_list[current_slide+1] == "Experience Information" then

   	auxbox_time()
    auxbox_prop_line("{6F7}")
    ched_xp_init()
   	auxbox_ched_xppmin() -- Level / Current XP / XP to next level / Last XP gain

------------------------------------------------------------------------------------------------[[ Item stock ]]

  elseif slides_list[current_slide+1] == "Item Count Information" then
    auxbox_time()

    auxbox_prop_line("{FFF}")

    item_color_indicator_name(0x3f0104, 30, true, "Greater yellow", true)
    item_color_indicator(0x105, 30, true)
    item_color_indicator_name(0x161, 30, true, "Green potion", true)
    item_color_indicator(0x177, 100, true)
    item_color_indicator_name(0x41d, 50, true, "Blank scroll", true)
    item_color_indicator(0x12b, 50, true)
    item_color_indicator_name(0x577, 30, true, "Dragon ration", true)

------------------------------------------------------------------------------------------[[ Extra Statistics ]]

  elseif slides_list[current_slide+1] == "Additional Stats" then
    auxbox_time()

    auxbox_blank_line()
    --auxbox_prop_line("{47F}HP: {6F7}"..me:get_hp_max().." {47F}MP: {6F7}"..me:get_mana_max(),"{47F}MR: {6F7}"..me:get_magic_resistance())
    --auxbox_prop_line("{47F}Str: {6F7}"..me:get_str().." {47F}Dex: {6F7}"..me:get_dex().." {47F}Int: {6F7}"..me:get_intel())
    character_age()

    auxbox_blank_line()
    auxbox_prop_line("{47F}Map : {FFF}"..cmap:get_level().." {BBB}("..cmap:get_max_x().."x"..cmap:get_max_y()..")")
    auxbox_prop_line("{47F}Tile: {BBB}"..tiledata:get_desc(cmap:get_tile(me.x, me.y)))
    
    auxbox_blank_line()
    auxbox_hunger_bar()

    auxbox_blank_line()
    --auxbox_prop_line("{BBB}Forums: forums.swut.net")
    --auxbox_prop_line("Manual: euotopia.com/manual")
    if d:numlock() then
      auxbox_prop_line("{FFF}Please turn numlock off!{47F}")
    else
      auxbox_blank_line()
    end

----------------------------------------------------------------------------------------------------[[ LM DPS ]]

  elseif slides_list[current_slide+1] == "Damage Per Second Info" then

    auxbox_lm_time()
    auxbox_prop_line("{A00}DPS: {FFF}"..auxbox_lm_dps(), "{CC0}XP/M: {FFF}"..auxbox_lm_xppm())
    
    auxbox_blank_line()
    auxbox_prop_line("{AAF}Recent {FF3}xp{AAF}, dmg {3F3}dealt{AAF}/{F33}taken{AAF}:{FFF}")
    auxbox_lm_last4xp()
    auxbox_lm_last4dmg()
    auxbox_lm_last4dmgt()

    auxbox_blank_line()
    auxbox_prop_line("{AAF}Total  {CC0}xp{AAF}/{F62}dmg dealt{AAF}/{F55}kills{AAF}:{FFF}")
    auxbox_prop_line(string.format("{CC0}%9.f {F62}%9.f {F55}%5.f{FFF}",  auxbox_lm_xp_gained(), auxbox_lm_dmg(), auxbox_lm_kills()))
    auxbox_blank_line()


-----------------------------------------------------------------------------------------------[[ Weapon Info ]]

  elseif slides_list[current_slide+1] == "Current Weapon Info" then
    auxbox_time()

    auxbox_blank_line()
    auxbox_prop_line("{47F}Current Weapon and Shield:")
    auxbox_prop_line_wrap("{B7F}"..wl:get_full_name(me.weapon), "{7FB}"..string.format("%x", me.weapon:intVal())) -- Hex code for the item wielded in the main hand
    auxbox_prop_line_wrap("{F7B}"..wl:get_full_name(me.shield), "{7FB}"..string.format("%x", me.shield:intVal()))

    auxbox_prop_line("{79F}Main: {FFF}"..wl:get_wep_skill_name(me.weapon)..", "..wl:get_wep_dmg_str(me.weapon))

    if (wl:is_weapon(me.shield)) then -- dual wielding
      auxbox_prop_line("{79F}Off : {FFF}"..wl:get_wep_skill_name(me.shield)..", "..wl:get_wep_dmg_str(me.shield))
    else
      auxbox_prop_line("{79F}Speed: {6F7}"..me:get_weapon_delay().."   ".."{79F}Dice: {6F7}"..me:get_dmg_dice().."d"..me:get_dmg_sides())
    end    
    
    --auxbox_prop_line("{79F}Stat Multiplier: {FFF}"..string.format("%.4f", me:stat_damage_multiplier()))


-------------------------------------------------------------------------------------------------[[ Instances ]]

  elseif slides_list[current_slide+1] == "Instances" then
    auxbox_time()

    auxbox_blank_line()
    auxbox_lm_dynamic_instance_reset_print()

----------------------------------------------------[[ LordMortiferus' ASCII MAP (requires higher resolution) ]]
  
  elseif slides_list[current_slide+1] == "ASCII Map" then

    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

-------------------------------------[[ Missing Slide (If you see this, lower your number_of_slides variable) ]]

  else
    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

  if d:numlock() then
    auxbox_go_to_line("{F00}---------------------------", nil, h-2)
    auxbox_go_to_line("{F00} Please turn numlock off!", nil, h-1)

  elseif cd ~= 1 then
    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)
  end
  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) -- length of prop_name (including color codes)
  local prop_val_len = string.len(prop_val)   -- length of prop_val (including color codes)
  local num_color_codes3 = 0 -- store the # of 3 digit color codes in prop_name {FFF}
  local num_color_codes6 = 0 -- store the # of 6 digit color codes in prop_name {FFFFFF}
  
  -- compensate for all color codes in prop_name and prop_val
  for find_color_codes in string.gmatch(prop_name, "{%x+}") do
    local this_color_code_len = string.len(find_color_codes)
    prop_name_len = prop_name_len - this_color_code_len
    if this_color_code_len == 5 then num_color_codes3 = num_color_codes3 + 1
    elseif this_color_code_len == 8 then num_color_codes6 = num_color_codes6 + 1
    else d:auxbox_set_line(auxbox_next_line, "{F56789}ERROR: Invalid color code!{FFF}"); break end -- This error appears if a color code is not 3 or 6 chars long
  end
  for find_color_codes in string.gmatch(prop_val, "{%x+}") do prop_val_len = prop_val_len - string.len(find_color_codes) end
  
  auxbox_next_line = auxbox_next_line + 1

  -- default prop_line (for when all of the text and color codes fit in the auxbox)
  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. Store the last color code, which may affect the next line.
    local final_cutoff_color = ""
    local cutoff_substr = string.sub(prop_name, auxbox_text_width-1 - prop_val_len + num_color_codes3*5 + num_color_codes6*8, string.len(prop_name))
    for find_color_codes in string.gmatch(cutoff_substr, "{%x+}") do -- if a color code was found after the cutoff
      local this_color_code_len = string.len(find_color_codes)
      if this_color_code_len == 5 then num_color_codes3 = num_color_codes3 - 1 -- 3 digit color codes
      else num_color_codes6 = num_color_codes6 - 1 -- 6 digit color codes
      end
      final_cutoff_color = find_color_codes -- store the last color code
    end
    
    -- store the index of the last printed char of prop_name
    local last_printed_pos = 0
    if prop_val=="" then -- if prop_val does not exist:
      last_printed_pos = auxbox_text_width + num_color_codes3*5 + num_color_codes6*8
    else -- if prop_val exists
      last_printed_pos = auxbox_text_width-1 - prop_val_len + num_color_codes3*5 + num_color_codes6*8

    end

    -- remove color codes that are partly cut-off. Store it to final_cutoff_color if they are the last color code in the prop_name
    -- check the last 7 printed prop_name chars for 6-digit color codes
    cutoff_substr = string.sub(prop_name, last_printed_pos-6, last_printed_pos)
    if string.find(cutoff_substr, "{") ~= nil then -- check for a '{', which signals that a color code is in danger of being cut off
      if string.find(cutoff_substr, "{%x+}") == nil then -- make sure this isn't a 3-digit color code
        local color_cutoff_pos = string.find(cutoff_substr, "{") + last_printed_pos-7 -- store the index of the full prop_name where the color code starts
        if final_cutoff_color == "" then final_cutoff_color = string.sub(prop_name, color_cutoff_pos, color_cutoff_pos+4) end -- update the final cutoff color a later one does not already exist 
        num_color_codes6 = num_color_codes6-1
      end
    end
    -- check the last 4 printed prop_name chars for 3-digit color codes
    cutoff_substr = string.sub(prop_name, last_printed_pos-3, last_printed_pos)
    if string.find(cutoff_substr, "{") ~= nil then -- check for a color code in danger of being cut off
      local color_cutoff_pos = string.find(cutoff_substr, "{") + last_printed_pos-7 -- store the index of the full prop_name where the color code starts
      if final_cutoff_color == "" then final_cutoff_color = string.sub(prop_name, color_cutoff_pos, color_cutoff_pos+4) end -- update the final cutoff color a later one does not already exist 
      num_color_codes3 = num_color_codes3-1
    end

    -- print prop_name and prop_val. Of note, whether prop_val exists or not changes the required spacing.
    if prop_val=="" then
      last_printed_pos = auxbox_text_width + num_color_codes3*5 + num_color_codes6*8 -- update the spacing info
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, auxbox_text_width - prop_val_len + num_color_codes3*5 + num_color_codes6*8)..final_cutoff_color)
    else
      last_printed_pos = auxbox_text_width-1 - prop_val_len + num_color_codes3*5 + num_color_codes6*8 -- update the spacing info
      d:auxbox_set_line(auxbox_next_line, string.sub(prop_name, 1, last_printed_pos)..final_cutoff_color.." "..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
  for find_color_codes in string.gfind(prop_val, "{%w%w%w%w%w%w}") do prop_val_len = prop_val_len - 8 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 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
        if string.find(string.sub(prop_name, i+4, i+4), "}") then -- 3 digit color codes
          end_of_substring = end_of_substring + 5
        else -- 6 digit color codes
          end_of_substring = end_of_substring + 8
        end
      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

----------------------------------------------------------------------------------------------------------------
--[[ Go To Line - Speed (Use this to jump to write something on a specific line, and override what would be under it) ]]
--     * note: may break if it uses colors

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

----------------------------------------------------------------------------------------------------------------
--[[ Function to round numbers, idp is the decimal place ]]

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

----------------------------------------------------------------------------------------------------------------
--[[ Explode - from http://lua-users.org/wiki/SplitJoin]]

function explode(d,p) -- explode(seperator, string)
  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's left in our array.
        break -- Break at end, as it should be, according to the lua manual.
      end
    end
  return t
end

----------------------------------------------------------------------------------------------------------------
--[[ Gets spell names ]]

function auxbox_ability_binds() 
  local cnt=0     
  for i=10,15 do
    if me.spell_binds[i]~=-1 then
     auxbox_prop_line(shift_keys[i-9], spells:get_full_spell_name(me.spell_binds[i]))
     cnt=cnt+1
    end
  end
  return cnt
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)
    --session_h_float = session_time / 60 / 60
    --session_h = math.floor(session_h_float)
    --session_m = math.floor((session_h_float - session_h) * 60)
    --session_s = math.floor(((session_h_float - 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)) 
     --auxbox_prop_line("{47F}Session Time:", "{FFF}"..string.format("%02.f:%02.f:%02.f", session_h, session_m, session_s)) 
   end 
end

----------------------------------------------------------------------------------------------------------------
--[[ Auxbox slides - Speed ]]

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

function auxbox_keypressed(key,ch,scancode)
 if gc_interface_mode==NORMAL then gch=ch end
end

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

--[[ Automaticly compiled client script for EUO ]]
-- Containing:
-- XP/min by Chedich
-- XP by LordMortiferus 2013/01/28, rehashed by Brentoboy
-- Edited by Speed, so not all of the features still work! I removed parts of the original code, so feel free to replace it with the original.

req_xp = {} -- beginning of XP-array
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 1022 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 -- end of XP-array

ched_init=true
ched_xp_arr={}

function ched_xp_init()
   if ched_init then
      if current_level <= 1000 then
         xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level])
       end
      ched_xp=me.xp
      ched_currentlvl=me.lvl-(me.remort_level*75)
      ched_lastxp=0
      ched_sessionxp = 0  -- Added by Speed
      ched_xp_next_level = 0
      ched_lasttick = 0
      ched_lastname=me.name
      ched_init=false

      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

      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_sessionxp = ched_sessionxp + ched_lastxp
      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)
      while ched_xp_next_level < 0 do --To account for non-meditated levels (changed from 'if' to 'while' to make this happen instantly)
         ched_currentlvl = ched_currentlvl + 1
         ched_xp_next_level = (req_xp[(ched_currentlvl+1)]-me.xp)
      end

      ched_exact_level = ched_currentlvl + (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl] - ched_xp_next_level) / (req_xp[ched_currentlvl+1] - req_xp[ched_currentlvl])
      ched_rounded_exact_level = round(ched_exact_level, 5)
   end
   
   auxbox_prop_line("Current Level:", string.format(ched_rounded_exact_level))
   auxbox_prop_line("Current XP:", string.format("%d", me.xp))
   auxbox_prop_line(string.format("XP for level "..string.format(ched_currentlvl + 1)..":"), req_xp[(ched_currentlvl+1)] - req_xp[(ched_currentlvl)])
   auxbox_prop_line("XP to next level:", ched_xp_next_level)
   auxbox_blank_line()
   auxbox_prop_line("{AAA}Session XP gain:", "{BBB}"..ched_sessionxp.." ")
   auxbox_prop_line("{AAA}Last XP gain:", "{FFF}"..ched_lastxp.." ")
end

----------------------------------------------------------------------------------------------------------------
--[[ 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

----------------------------------------------------------------------------------------------------------------
--[[ Item stock color 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, false)
end

function item_color_indicator_name(item_code, max_amt_item, show_max, item_name, padding)
  --local item_amount = items:get_qty_basecode(item_code) -- this version of item_amount does not account for tints/enchants
  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
  if padding then 
    auxbox_prop_line("{FFF}"..item_name:gsub("^%l", string.upper).."{999} -----------------------", item_color_full.."{FFF}")
  else
    auxbox_prop_line("{FFF}"..item_name:gsub("^%l", string.upper), item_color_full.."{FFF}")
  end
end

----------------------------------------------------------------------------------------------------------------
--[[ Auxbox 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
      --[[
      if yy == sy or yy == ey then
        table.insert (asciimap,22," {fff}-10")
      elseif yy == sy+5 or yy == sy+15 then
        table.insert (asciimap,22," {fff}-5 ")
      elseif yy == sy+10 then
        table.insert (asciimap,22," {fff}-0 ")
      else
        table.insert (asciimap,22,"    ")
      end 
      --]]     
      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

----------------------------------------------------------------------------------------------------------------
--[[ Dynamic Instance Reset - LordMortiferus ]]
--    * note: split into two functions to update and print separately

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()

  local noInstanceOpen = "No instances are open!"
  local lm_instance_reset = 0
  for i, v in pairs(lm_instancemap_log) do
    lm_instance_reset = 600 - (os.time() - v) 
    noInstanceOpen = ""
    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
       if #lm_instancemap_log == 0 then noInstanceOpen = "No instances are open!" end
    end
  end
  auxbox_prop_line(noInstanceOpen)
end

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

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

function check_reset_lm_dpscalc() -- Speed
  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

function auxbox_lm_dpscalc ()

  if lm_dpscalc_pause == false then

    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_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("{99F}M{47F}:Pause-[{FFF}"..string.format("%03.f{777}:{FFF}%02.f{777}:{FFF}%02.f", h, m, s).."{47F}]-Reset:{99F}X{FFF}")
end

function auxbox_lm_kills()
   return lm_kill_count
end

function auxbox_lm_hits()
   return lm_hit_count
end

function auxbox_lm_dmg()
   return lm_total_dmg
end

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

function auxbox_lm_xp_gained()
return lm_xp_gained
end

function auxbox_lm_xppm()
   if lm_hunt_time == 0 then
      return string.format("%d", 0)
   else
      return string.format("%d", lm_xp_gained / lm_hunt_time * 60)
   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("{070}%5.f {1A1}%5.f {2D2}%5.f {3F3}%5.f{FFF}", hit4, hit3, hit2, hit1))
   auxbox_prop_line(string.format("{070}%6.f {1A1}%6.f {2D2}%6.f {3F3}%6.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("{700}%5.f {A11}%5.f {D22}%5.f {F33}%5.f{FFF}", hit4, hit3, hit2, hit1))
   auxbox_prop_line(string.format("{700}%6.f {A11}%6.f {D22}%6.f {F33}%6.f{FFF}", hit4, hit3, hit2, hit1))
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("{770}%5.f {AA1}%5.f {DD2}%5.f {FF3}%5.f{FFF}", kill4, kill3, kill2, kill1))
   auxbox_prop_line(string.format("{770}%6.f {AA1}%6.f {DD2}%6.f {FF3}%6.f{FFF}", kill4, kill3, kill2, kill1))
end
Small edit: Added Sagittarius to the instance list
You do not have the required permissions to view the files attached to this post.
-Speed(COG) = [Grandmaster Stafffighter idk...]
User avatar
Keighn
Stop posting already --;
Posts: 5509
Joined: Sat Jun 26, 2004 10:13 am
Location: Hey.... pssttt Back in Orgeon

Re: Completed Auxbox

Post by Keighn »

So this is even better than that one on discord? Lordy! I need to get some internet.
ZUPS!!!!
User avatar
speed
LAUGHING OUT LOUD LIKE A MORON
Posts: 54
Joined: Tue Jul 14, 2009 7:49 am

Re: Completed Auxbox

Post by speed »

It's the same in terms of functionality, but it's been updated to incorporate some of the new color features!
-Speed(COG) = [Grandmaster Stafffighter idk...]
User avatar
Keighn
Stop posting already --;
Posts: 5509
Joined: Sat Jun 26, 2004 10:13 am
Location: Hey.... pssttt Back in Orgeon

Re: Completed Auxbox

Post by Keighn »

Bah! I need to play again. Curse T-mobile. T stands for TERRIBLE.
ZUPS!!!!
Post Reply