Custom Auxbox Creations

Moderator: EUO Moderators

Post Reply
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

brentoboy wrote:
CIAassassin wrote:Oh? That was credited to you in one of the scripts I was sent. Oh well, the owner can step up if they want to.

The 5 hit counter was a tweak I made in the middle of the DPS script.
Actually, I believe it was a 4 hit counter when I did it.

We are getting to a point where many of the scripts as they are being circulated have multiple authors.
Most likely.
brentoboy wrote:@CIA ... I think

the first post you made had the quantities for several items.
How did you go about figuring out a code for an item you want info about?
They are scattered through the different files, not sure which folder without looking, "misc" "items" etc. I can go through and pull out the generally important numbers if need be, ie bullets, mega potions, scrolls Also, most of the leg work was already done by the original author (LM I think?) the only thing I found were the bullets and arrows, and then spliced the code into it. I don't know when to use get_item_basecode vs create_item_basecode or whatever the lines are.

Ill go ahead and set up a list and post it here. Ill do it as a code segment so you can just copy and paste it into your lua.
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
User avatar
LordMortiferus
MACRO > me
Posts: 872
Joined: Tue Dec 01, 2009 10:23 pm

Re: Custom Auxbox Creations

Post by LordMortiferus »

I did not post any item codes or had anything to do with scripts involving item codes sofar.
But you can post or msg me what you want and I get the codes for you later..

Edit: I updated the following scripts:
ASCII map
ASCII map with LOS
dps
The dps script is work in progress. It displays various dmg/dps values as well as time between hits. Dps is calculated with weapon_delay for the first 30 hits and afterward it uses the median time between hits. I still have to get dual wielding into this, but dps after 30 hits should work well with dual wielding and magic casting.
brentoboy
LAUGHING OUT LOUD LIKE A MORON
Posts: 73
Joined: Thu Jul 05, 2012 1:39 pm

Re: Custom Auxbox Creations

Post by brentoboy »

OK, I see how you get the codes for the items.

How do you create codes for items that are lumped together.

For instance, the scrolls all have the same base code (286)
I see that SL has a sub-code: 18
and KOP is 13.
how do I find out the sub-code for IMJ ?

Also, I see that soul shards are 1283 ...
but how do I create a code for the various charged shards?
PD: Duncan
Reg: Zen / Natasha
Chedich
on lolpatrol
Posts: 254
Joined: Wed Jan 14, 2004 12:51 am

Re: Custom Auxbox Creations

Post by Chedich »

That would likely be me that made the function that you're referring to. I've posted a more recent version of my script in this thread. In that one i'm using a different approach to listing items left.

The spell ID for IMJ is 43.

The basecodes for the different charged shards are:
0x450 dull_red_shard
0x451 dim_red_shard
0x452 bright_red_shard
0x453 brilliant_red_shard
0x454 dull_blue_shard
0x455 dim_blue_shard
0x456 bright_blue_shard
0x457 brilliant_blue_shard

I mostly used the following functions to figure out item codes and base codes, but there is also a lot of information found in the files in the 'dat' folder.

Code: Select all

-- Bound Item Quantities(modified to show basecodes)  - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
function auxbox_bound_item_basecodes()
	local item
	local name
	for i = 1, 50 do	
		item = me.item_binds[i]
		name = wl:get_full_name(item)
		
		if item 
		and not wl:is_tool(item)
		and name ~= "NOTHING" 
		then	
			auxbox_prop_line(name, get_base_code(item))
		end
	end
end
and

Code: Select all

function testitem(code)
	auxbox_prop_line(wl:get_full_name(code))
	auxbox_prop_line(items:get_qty(code))
end
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

Last edited by CIAassassin on Thu Jun 06, 2013 8:17 am, edited 1 time in total.
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
User avatar
LordMortiferus
MACRO > me
Posts: 872
Joined: Tue Dec 01, 2009 10:23 pm

Re: Custom Auxbox Creations

Post by LordMortiferus »

Actually you guys can use maped to get a lot of item codes.
Here are a couple of scrolls:

0x41d blank scroll
0x120 resurrection scroll
0x125 town portal scroll
0x13a scroll of unweld
0x13b scroll of uncurse
0x13c scroll of identify
0x16d raise pet scroll
0x510 scroll of truesight
0x511 scroll of protection
0x512 scroll of health
0x1f0512 improved scroll of health
0x2f0512 refined scroll of health
0x3f0512 greater scroll of health
0x513 scroll of identify all
0x514 scroll of uncurse all
0x10011e In Lor
0x40011e Vas Lor
0x70011e S
0x2b0011e In Mani Junx
0xd0011e Kal Ort Por
0x1200e11 Sanct Lor
0xc00e11 Kal Por Ylem

Edit: did an other update for this dps-script. Dps calculation starts after the first hit and i separated sd values from mean values to make it easier to remove them from auxbox. Next step will be more clean up and hopefully dual wielding.
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

OK, here is a new list of the codes I have. Thanks Ched for the assist and teaching me about the make_code vs basecode use. Tore through it after I got that sorted out. I have everything in semi category, ie potions/alchemy in one, mining in another. Now, this is just a rough list and I tailored it to what I WOULD WANT at 100% in each skill, or at max of what I need to craft what I want. This is by no means a complete list, but it's got a substantial amount of information in it. I will update this post as I add more when people ask to see something in the list. I would rather not go through and rework all of the items in the game to be put into this list either... so please don't ask for that.

todo: woodcrafting


NOTE: THIS IS NOT A FUNCTION JUST A LIST OF ITEMS TO COPY AND PASTE INTO YOUR FUNCTION BODY!


A few tips for new people: anything in "" can be changed to whatever you want, as long as it stays closed in "". That is the item name and some of them a rather long, hence why I abbreviated the health scrolls.

Code: Select all

   auxbox_prop_line("Purple Potions:", items:get_qty_basecode(0x168))
   auxbox_prop_line("Khaki Potions:", items:get_qty_basecode(0x17c))
   auxbox_prop_line("White Potions:", items:get_qty_basecode(0x162))
   auxbox_prop_line("Cyan Potions:", items:get_qty_basecode(0x164))
   auxbox_prop_line("Orange Potions:", items:get_qty_basecode(0x163))
   auxbox_prop_line("Brown Potions:", items:get_qty_basecode(0x166))
   auxbox_prop_line("Blue Potions:", items:get_qty(make_code(0x105, 0, 0, 0)))
   auxbox_prop_line("Improved Blue:", items:get_qty(make_code(0x105, 0, 15, 1)))
   auxbox_prop_line("Refined Blue:", items:get_qty(make_code(0x105, 0, 15, 2)))
   auxbox_prop_line("Greater Blue:", items:get_qty(make_code(0x105, 0, 15, 3)))
   auxbox_prop_line("Mega Blue Potions:", items:get_qty_basecode(0x16c))
   auxbox_prop_line("Yellow Potions:", items:get_qty(make_code(0x104, 0, 0, 0)))
   auxbox_prop_line("Improved Yellow:", items:get_qty(make_code(0x104, 0, 15, 1)))
   auxbox_prop_line("Refined Yellow:", items:get_qty(make_code(0x104, 0, 15, 2)))
   auxbox_prop_line("Greater Yellow:", items:get_qty(make_code(0x104, 0, 15, 3)))
   auxbox_prop_line("Mega Yellow Potions:", items:get_qty_basecode(0x16b))
   auxbox_prop_line("Reinforced Flask:", items:get_qty_basecode(0x16a))
   auxbox_prop_line("Flask:", items:get_qty_basecode(0x14f))
   auxbox_prop_line("Black Potions:", items:get_qty_basecode(0x160))
   auxbox_prop_line("Alembic:", items:get_qty_basecode(0x155))
   auxbox_prop_line("Spiders Silk:", items:get_qty_basecode(0x14c))
   auxbox_prop_line("Blood Moss:", items:get_qty_basecode(0x147))
   auxbox_prop_line("Ginseng:", items:get_qty_basecode(0x149))
   
   auxbox_prop_line("Quill:", items:get_qty_basecode(0x176))
   auxbox_prop_line("Blank Scrolls:", items:get_qty_basecode(0x41d))
   auxbox_prop_line("Scroll of Health:", items:get_qty(make_code(0x512, 0, 0, 0)))
   auxbox_prop_line("ISoH:", items:get_qty(make_code(0x512, 0, 15, 1)))
   auxbox_prop_line("RSoH:", items:get_qty(make_code(0x512, 0, 15, 2)))
   auxbox_prop_line("GSoH:", items:get_qty(make_code(0x512, 0, 15, 3)))
   auxbox_prop_line("Scroll of Protection:", items:get_qty_basecode(0x511))
   auxbox_prop_line("Scroll of Truesight:", items:get_qty_basecode(0x510))
   auxbox_prop_line("Town Portal:", items:get_qty_basecode(0x125))
   auxbox_prop_line("Ressurection Scroll:", items:get_qty_basecode(0x120))
   auxbox_prop_line("Scroll of Galvinising:", items:get_qty_basecode(0x5cc))
   auxbox_prop_line("Sanct Lor:", items:get_qty(make_code(0x11e, 0, 0, 18)))
   auxbox_prop_line("Vas Lor", items:get_qty(make_code(0x11e, 0, 0, 4)))
   auxbox_prop_line("In Mani Jux:", items:get_qty(make_code(0x11e, 0, 0, 43)))
   auxbox_prop_line("Kal Ort Por:", items:get_qty(make_code(0x11e, 0, 0, 13)))
   auxbox_prop_line("Kal Por Ylem:", items:get_qty(make_code(0x11e, 0, 0, 12)))
   
   auxbox_prop_line("Dragon Rations:", items:get_qty_basecode(0x577))
   auxbox_prop_line("Omelettes:", items:get_qty_basecode(0x564))
   
   auxbox_prop_line("Wand of Deconstruction:", items:get_qty_basecode(0x53b))
   auxbox_prop_line("Disenchanting Wand:", items:get_qty_basecode(0x516))
   auxbox_prop_line("Enchanting Wand:", items:get_qty_basecode(0x501))
   auxbox_prop_line("Polypile Wand:", items:get_qty_basecode(0x502))
   auxbox_prop_line("Wand of Petrification:", items:get_qty_basecode(0x564))
   
   auxbox_prop_line("Blackrock:", items:get_qty_basecode(0x156))
   auxbox_prop_line("Blackrock Ore:", items:get_qty(make_code(0x113, 0xc, 0, 0)))
   auxbox_prop_line("Silver Ore:", items:get_qty(make_code(0x113, 6, 0, 0)))
   auxbox_prop_line("Iron Ore:", items:get_qty(make_code(0x113, 2, 0, 0)))
   auxbox_prop_line("Copper Ore:", items:get_qty(make_code(0x113, 3, 0, 0)))
   auxbox_prop_line("Zinc Ore:", items:get_qty(make_code(0x113, 8, 0, 0)))
   auxbox_prop_line("Mithril Ore:", items:get_qty(make_code(0x113, 0x10, 0, 0)))
   auxbox_prop_line("Armourers Hammer:", items:get_qty_basecode(0x157))
   auxbox_prop_line("Smiths Hammer", items:get_qty_basecode(0x11f))
   auxbox_prop_line("Blackrock Ingot:", items:get_qty(make_code(0x118, 0xc, 0, 0)))
   auxbox_prop_line("Silver Ingot:", items:get_qty(make_code(0x118, 6, 0, 0)))
   auxbox_prop_line("Iron Ingot:", items:get_qty(make_code(0x118, 2, 0, 0)))
   auxbox_prop_line("Copper Ingot:", items:get_qty(make_code(0x118, 3, 0, 0)))
   auxbox_prop_line("Zinc Ingot:", items:get_qty(make_code(0x118, 8, 0, 0)))
   auxbox_prop_line("Brass Ingot:", items:get_qty(make_code(0x118, 4, 0, 0)))
   auxbox_prop_line("Venomous Ingot:", items:get_qty(make_code(0x118, 0xa, 0, 0)))
   auxbox_prop_line("Gold Ingot:", items:get_qty(make_code(0x118, 7, 0, 0)))
   auxbox_prop_line("Mithril Ingot:", items:get_qty(make_code(0x118, 0x10, 0, 0)))
   
   auxbox_prop_line("Tinkers Toolkit:", items:get_qty_basecode(0x152))
   auxbox_prop_line("Raw Glass:", items:get_qty_basecode(0x41b))
   auxbox_prop_line("Pole:", items:get_qty_basecode(0x410))
   auxbox_prop_line("Silver Sheet:", items:get_qty_basecode(0x40c))
   auxbox_prop_line("Brass Sheet:", items:get_qty_basecode(0x40d))
   
   auxbox_prop_line("Probes:", items:get_qty_basecode(0x141))
   auxbox_prop_line("Lockpicks:", items:get_qty_basecode(0x11c))
   auxbox_prop_line("Bandages:", items:get_qty_basecode(0x177))
   auxbox_prop_line("Skull Key:", items:get_qty_basecode(0x521))
   auxbox_prop_line("Arrow:", items:get_qty_basecode(0x128))
   auxbox_prop_line("Bullets:", items:get_qty_basecode(0x50e))
   auxbox_prop_line("Soul Shards:", items:get_qty_basecode(1283))
   
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
Loughf
LAUGHING OUT LOUD LIKE A MORON
Posts: 63
Joined: Fri May 10, 2013 9:24 am

Re: Custom Auxbox Creations

Post by Loughf »

is there a way to list skills that are not at 100%? once reached 100% it'll remove itself? ex:

Code: Select all

shortswords     99
ranged     97
enchanting     82
locks     81
traps     80
tailoring     76
once I got shortswords to 100, it would remove itself to look like :

Code: Select all

ranged     97
enchanting     82
locks     81
traps     80
tailoring     76
brentoboy
LAUGHING OUT LOUD LIKE A MORON
Posts: 73
Joined: Thu Jul 05, 2012 1:39 pm

Re: Custom Auxbox Creations

Post by brentoboy »

Loughf wrote:is there a way to list skills that are not at 100%? once reached 100% it'll remove itself?
Yeah, next time I work on my script, I'll have it do that.
Now that you mention it, I think that's what most people would want.


if you want to tweak it yourself.... find this function...

Code: Select all

function auxbox_skill_line(skill_index)
	if me:get_skill(skill_index) > 0 then
		auxbox_prop_line(auxbox_skill_names[skill_index], string.format("%.3f%%", me:get_skill(skill_index)))
	end	
end
and switch it out for this one

Code: Select all

function auxbox_skill_line(skill_index)
	if me:get_skill(skill_index) > 0 
	and me:get_skill(skill_index) < 100 
	then
		auxbox_prop_line(auxbox_skill_names[skill_index], string.format("%.3f%%", me:get_skill(skill_index)))
	end	
end
Last edited by brentoboy on Thu Jun 06, 2013 11:47 pm, edited 1 time in total.
PD: Duncan
Reg: Zen / Natasha
Loughf
LAUGHING OUT LOUD LIKE A MORON
Posts: 63
Joined: Fri May 10, 2013 9:24 am

Re: Custom Auxbox Creations

Post by Loughf »

ty ty ty!
Loughf
LAUGHING OUT LOUD LIKE A MORON
Posts: 63
Joined: Fri May 10, 2013 9:24 am

Re: Custom Auxbox Creations

Post by Loughf »

it worked! Thank youuu!
User avatar
LordMortiferus
MACRO > me
Posts: 872
Joined: Tue Dec 01, 2009 10:23 pm

Re: Custom Auxbox Creations

Post by LordMortiferus »

Improved last 5 hits script.

Code: Select all

auxbox_next_line = 0

function auxbox()
  d:auxbox_clear();
  auxbox_next_line = 0
  auxbox_lm_last5hits()
end

function auxbox_prop_line(prop_name, prop_val)
  local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
  auxbox_next_line = auxbox_next_line + 1
  d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
end

function auxbox_blank_line()
  auxbox_next_line = auxbox_next_line + 1
end

last_dpst = g_dpst
lm_5dmg_log = {0,0,0,0,0}
function auxbox_lm_last5hits()
  	
local current_dmg
	
    if last_dpst ~= g_dpst then
	 current_dmg = g_dpst - last_dpst
	 table.insert(lm_5dmg_log, 1, current_dmg)
	 last_dpst = g_dpst
	end

    if lm_5dmg_log[6] ~= nil then
        table.remove(lm_5dmg_log, 6)
    end
 
 auxbox_prop_line("Last 5 Hits:", "")
 auxbox_prop_line("", string.format("%4.f %4.f %4.f %4.f %4.f", lm_5dmg_log[5],lm_5dmg_log[4], lm_5dmg_log[3], lm_5dmg_log[2], lm_5dmg_log[1]))
 
end
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

brentoboy wrote:OK, I see how you get the codes for the items.

How do you create codes for items that are lumped together.

For instance, the scrolls all have the same base code (286)
I see that SL has a sub-code: 18
and KOP is 13.
how do I find out the sub-code for IMJ ?

Also, I see that soul shards are 1283 ...
but how do I create a code for the various charged shards?
Brento, I have those scrolls in the item list done up already if you havent seen it. Ill look into the shards if you havent already figured it out?

For those who havent seen it, and those who have, the completed codes are up to date (I think) in this thread.
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
Turtle
Good morning, Captain.
Posts: 302
Joined: Mon Aug 25, 2008 5:15 pm

Re: Custom Auxbox Creations

Post by Turtle »

brentoboy wrote:@turtle...
did you ever get the recent skills section to work. if not, post what you have, and I'll compare it with the original, and get it working for you.
Thanks for replying! This is the entirety of the script I'm using.
CIAassassin wrote:

Code: Select all

    session_start = os.time() - 1
	function auxbox()
          d:auxbox_clear();
	  auxbox_next_line = 0
          auxbox_real_world_time()
	  auxbox_blank_line()
	  auxbox_damage_per_second()
          auxbox_xp()
	  auxbox_recent_skill_levels()
          auxbox_recent_crafting_skill_levels()
    end

    function auxbox_prop_line(prop_name, prop_val)
      local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
      auxbox_next_line = auxbox_next_line + 1
      d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
    end

    function auxbox_blank_line()
      auxbox_next_line = auxbox_next_line + 1
    end

    function auxbox_real_world_time()
      auxbox_prop_line("Real World Time:", string.format(os.date("%I:%M%p")))
    end


    -- Damage Per Second (by Severian)
    -- starts displaying DPS after 35 hits, and gets more accurate the more hits you make
    -- assumes few intervals walking and more intervals between continuous hits

    VERBOSE_DPS_REPORT = true
    last_dpst = g_dpst
    hits_recorded = 0
    dmg_log = {}
    median_damage = -1
    recent_hit_times = {}
    five_hit_intervals = {}
    median_interval = -1

    function auxbox_damage_per_second()
      local current_time
      local current_dmg
      local current_five_hit_interval
      local temp_var
      local temp_five_hit_intervals
      local temp_dmg_log
        if last_dpst ~= g_dpst then
          current_time = os.time()
          current_dmg = g_dpst - last_dpst
          hits_recorded = hits_recorded + 1
            if hits_recorded <= 30 then -- first 30 hits
              table.insert(dmg_log, 1, current_dmg)
            else -- on and after the 31st hit
              table.remove(dmg_log, 30)
              table.insert(dmg_log, 1, current_dmg)
            end
          
		  last_dpst = g_dpst
            if hits_recorded < 6 then -- first 5 hits
              table.insert(recent_hit_times, 1, current_time)
            else -- on and after the 6th hit
              table.remove(recent_hit_times, 5)
              table.insert(recent_hit_times, 1, current_time)
            end
          
		    if hits_recorded >= 5 then
              current_five_hit_interval = recent_hit_times[1] - recent_hit_times[5]
                if hits_recorded <= 35 then -- first 30 "5 hit" intervals
                  table.insert(five_hit_intervals, 1, current_five_hit_interval)
                else -- on and after the 31st "5 hit" interval
                  table.remove(five_hit_intervals, 30)
                  table.insert(five_hit_intervals, 1, current_five_hit_interval)
                end
            end
        end
        
		if hits_recorded < 35 then
          temp_var = 35 - hits_recorded
          auxbox_prop_line("DPS:", string.format("...in %d hits...", temp_var))
          if VERBOSE_DPS_REPORT then auxbox_prop_line("Median Damage:", "") end
          if VERBOSE_DPS_REPORT then auxbox_prop_line("Median 5-Hit Time:", "") end
        else
          temp_dmg_log = {}
            for i,v in pairs(dmg_log) do
              temp_dmg_log[i] = v
            end
          
		  table.sort(temp_dmg_log)
          temp_five_hit_intervals = {}
            for i,v in pairs(five_hit_intervals) do
              temp_five_hit_intervals[i] = v
            end
          
		  table.sort(temp_five_hit_intervals)
          median_damage = math.ceil((temp_dmg_log[15] + temp_dmg_log[16]) / 2)
          median_interval = math.floor((temp_five_hit_intervals[15] + temp_five_hit_intervals[16]) / 2)
          temp_var = math.floor((median_damage * 5) / median_interval)
          auxbox_prop_line("DPS:", string.format("%d", temp_var))
            if VERBOSE_DPS_REPORT then
              auxbox_prop_line("Median Damage:", string.format("%d", median_damage))
            end
            if VERBOSE_DPS_REPORT then
              auxbox_prop_line("Median 5-Hit Time:", string.format("%d", median_interval))
            end
        end
    end

    session_start_xp = me.xp -- var to calculate xp gain per session
    session_start_age = me.age -- var to calculate time played per session
    session_time = 0
    current_level = 0

    -- beginning of XP-array
    req_xp = {}
    req_xp[1] = 0 -- fixed XP value
    req_xp[2] = 200 -- fixed XP value
    req_xp[26] = 93000 -- fixed XP value

    for i=3,25 do -- adds XP for lvl 3 to 25 to array
      req_xp[i] = math.floor(req_xp[i-1]+1.2*(req_xp[i-1]-req_xp[i-2]))
    end

    for i=27,1000 do -- adds XP for lvl 27 to 1000 to array
      req_xp[i] = req_xp[i-1]+(i-26)*1000*4+15000
    end

    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

    function auxbox_xp()
        if current_level <= 1000 then
          local xptolvl_float = ((me.xp - req_xp[current_level]))/(req_xp[current_level+1]-req_xp[current_level]) -- % needed for next level
          local lvl_float = current_level + me.remort_level * 75 + xptolvl_float -- combines actual lvl with the % needed for next lvl

          -- checks if player leveled or remorted
            if xptolvl_float >= 1 or xptolvl_float < 0 then
              for i = 1,999 do
                if req_xp[i] <= me.xp
                 and req_xp[i + 1] > me.xp
                then
                  current_level = i
                  break
                end
            end
        end
          
        if os.difftime(os.time(), session_start) > session_time then -- just to reduce the script to every second
          session_time = os.difftime(os.time(), session_start)
          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)

          xpgain = me.xp - session_start_xp 
          xps = xpgain/session_time

            if me.age-session_start_age > 0  then
              xpmin = xpgain/(me.age-session_start_age)
            else
              xpmin = 0
            end

          xptolvl = req_xp[current_level + 1] - me.xp
          xpto1k = req_xp[1000] - me.xp

            if xps > 0 then
              timetolvl = xptolvl / xps
              timeto1k = xpto1k / xps
            else
              timetolvl = 0
              timeto1k = 0
            end

          timetolvl_d_float = timetolvl / 60 / 60 / 24
          timetolvl_d = math.floor(timetolvl_d_float)
          timetolvl_h = math.floor((timetolvl_d_float - timetolvl_d)*24)
          timetolvl_m = math.floor(((timetolvl_d_float - timetolvl_d)*24 - timetolvl_h) * 60)
          timetolvl_s = math.floor((((timetolvl_d_float - timetolvl_d)*24 - timetolvl_h) * 60 - timetolvl_m) * 60)

          timeto1k_d_float = timeto1k / 60 / 60 / 24
          timeto1k_d = math.floor(timeto1k_d_float)
          timeto1k_h = math.floor((timeto1k_d_float - timeto1k_d)*24)
          timeto1k_m = math.floor(((timeto1k_d_float - timeto1k_d)*24 - timeto1k_h) * 60)
          timeto1k_s = math.floor((((timeto1k_d_float - timeto1k_d)*24 - timeto1k_h) * 60 - timeto1k_m) * 60)
        end
          auxbox_prop_line("XP to Level:", string.format("%d", xptolvl))
          auxbox_prop_line("XP per Minute:" ,string.format("%d", xpmin))
          auxbox_prop_line("Time to Level:" ,string.format("%02.f:%02.f:%02.f:%02.f", timetolvl_d, timetolvl_h, timetolvl_m, timetolvl_s))
    end
end

   
    function auxbox_prop_line(prop_name, prop_val)
      local pvl=0
      if prop_name==nil then prop_name="" end
      if prop_val==nil then prop_val="" end
      local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
      auxbox_next_line = auxbox_next_line + 1
      d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
   
 -- shows level of any skill that has recently received experience
    -- you should really either use THIS or auxbox_class_skill_levels + auxbox_recent_craft_skill_levels
    -- the advantage of this function is that it doesnt show class skills if you arent currently working on them (saves space)
    function auxbox_recent_skill_levels()
       for i = 0, skill_count do
          if auxbox_skill_last_updated[i] > auxboxcnt - 300
          and auxbox_skill_last_updated[i] > 1
          then
             auxbox_skill_line(i)
          end
       end
    end

    -- shows level of any non-class skill that has recently received experience
    function auxbox_recent_crafting_skill_levels()
       for i = 1, #auxbox_crafting_skills do
          if auxbox_skill_last_updated[auxbox_crafting_skills[i]] > auxboxcnt - 300
          and auxbox_skill_last_updated[auxbox_crafting_skills[i]] > 1
          then
             auxbox_skill_line(auxbox_crafting_skills[i])
          end
       end
    end
here ya go.
User avatar
LordMortiferus
MACRO > me
Posts: 872
Joined: Tue Dec 01, 2009 10:23 pm

Re: Custom Auxbox Creations

Post by LordMortiferus »

Added some more statistic output to this script. It includes a pseudo but maybe perfect working kill counter. I still working on good dual wield implementation.
I also added a preview behind the functions called in "function auxbox()" making it easier to remove unneeded statistical output.
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

Turtle wrote:
brentoboy wrote:@turtle...
did you ever get the recent skills section to work. if not, post what you have, and I'll compare it with the original, and get it working for you.
Thanks for replying! This is the entirety of the script I'm using.
Dont know if Brent got it working for you, I took a look at it again and I have it working now. I royally mucked up the original code. :fp: This is with the dynamic skill meter (at 100% it removes off the list) I couldnt get the recent_skill code to work, I spent a few hours trying to get it working but to no success. Brent will have to get that one to work, but this one shows all skills at <100%, xp, DPS. I used the most recent XP code, instead of the original code I had (which seemed a little buggy) the one Im using now is much better IMO.

Code: Select all

        session_start = os.time() - 1
        auxbox_next_line = 0

        function auxbox()
           d:auxbox_clear();
           auxbox_next_line = 0       
           update_skill_experience()
		   auxbox_real_world_time()
		   auxbox_blank_line()
           auxbox_all_skill_levels()
		   ched_xp_init()
		   auxbox_ched_xppmin()
		   auxbox_damage_per_second()
        end

        function auxbox_prop_line(prop_name, prop_val)
            local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
           auxbox_next_line = auxbox_next_line + 1
           d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
        end

        function auxbox_blank_line()
           auxbox_next_line = auxbox_next_line + 1
        end

       function auxbox_real_world_time()
            auxbox_prop_line("Real World Time:", string.format(os.date("%I:%M%p")))
       end
		
        -- Skill level stuff - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
        skill_count = 40

        auxbox_class_skills =
        {   0, 1, 2, 3, 26 --fighter
        ,   17, 18, 13, 14, 15, 9   --thief
        ,   7, 33 -- mage
        ,   34, 38, 36  -- priest
        ,   10, 40 -- monk
        }

        auxbox_crafting_skills =
        {   4
        ,   5
        ,    6
        ,   8
        ,   11
        ,   12
        ,   16
        ,   19
        ,   20
        ,   21, 22, 23, 24, 25
        ,   27, 28
        ,   29
        ,   30
        ,   31, 32
        ,   35, 37
        ,   39
        }

        auxbox_prev_skill_values = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
        auxbox_skill_last_updated = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
        auxbox_prev_skill_values[0] = -1
        auxbox_skill_last_updated[0] = -1

        auxbox_skill_names =
        {    "polearms" -- 1
        ,   "maces" -- 2
        ,   "tactics" -- 3
        ,   "woodcrafting" --4
        ,   "mining" -- 5
        ,   "weaponsmith" -- 6
        ,   "magery" -- 7
        ,   "fishing" -- 8
        ,   "locks" --9
        ,   "unarmed" --10
        ,   "meditation" -- 11
        ,   "alchemy" --12
        ,   "ranged" --13
        ,   "stealth" --14
        ,   "traps" --15
        ,   "item lore" --16
        ,   "shortswords" --17
        ,   "foils" -- 18
        ,   "Skill 19"
        ,   "tailoring" --20
        ,   "tinkering" -- 21
        ,   "Skill 22"
        ,   "Skill 23"
        ,   "Skill 24"
        ,   "Skill 25"
        ,   "block" --26
        ,   "cartography" --27
        ,   "healing" --28
        ,   "enchanting"  --29
        ,   "armourer" -- 30
        ,   "inscription" --31
        ,   "taming" --32
        ,   "sorcery" --33
        ,   "piety" --34
        ,   "Skill 35"
        ,   "blessed maces" --36
        ,   "staves" -- 37
        ,   "divinity" --38
        ,   "cooking" --39
        ,   "sanctity" --40
        }
        auxbox_skill_names[0] = "longswords"

        function auxbox_skill_line(skill_index)
           if me:get_skill(skill_index) > 0
           and me:get_skill(skill_index) < 100
           then
              auxbox_prop_line(auxbox_skill_names[skill_index], string.format("%.3f%%", me:get_skill(skill_index)))
           end   
        end

        -- I used this for debugging, its pretty similar to the skill tab, so kind of pointless, but why delete it, now that it works
        function auxbox_all_skill_levels()
           for i = 0, skill_count do
              auxbox_skill_line(i)
           end
        end

        -- you have to call this before either of the two functions below it or they wont know what has recently changed
        function update_skill_experience()
           for i = 0, skill_count do
              if auxbox_prev_skill_values[i] < me:get_skill(i) then
                 auxbox_skill_last_updated[i] = auxboxcnt
                 auxbox_prev_skill_values[i] = me:get_skill(i)
              end
           end
        end
		
	-- beginning of XP-array
req_xp = {}
req_xp[1] = 0 -- fixed XP value
req_xp[2] = 200 -- fixed XP value
req_xp[26] = 93000 -- fixed XP value

for i=3,25 do -- adds XP for lvl 3 to 25 to array
  req_xp[i] = math.floor(req_xp[i-1]+1.2*(req_xp[i-1]-req_xp[i-2]))
end

for i=27,1000 do -- adds XP for lvl 27 to 1000 to array
  req_xp[i] = req_xp[i-1]+(i-26)*1000*4+15000
end

-- snip snip
-- end of XP-array

ched_init=true
ched_xp_arr={}

function ched_xp_init()
   if ched_init then
      ched_xp=me.xp
      ched_currentlvl=me.lvl-(me.remort_level*75)
      ched_lastxp=0
      ched_xp_next_level = 0
      ched_xp_p_fmin = 0
      ched_xp_p_tmin = 0
      ched_xp_lasttickxp = me.xp
      ched_lasttick = 0
      ched_lastname=me.name
      ched_init=false

      for i=1,600 do
         ched_xp_arr[i]=0
      end
   end
end
function auxbox_ched_xppmin()
   if ched_xp<me.xp then
      ched_lastxp=me.xp-ched_xp
      ched_xp=me.xp
   end
   if ched_init then
      return
   end
   if ched_lastxp == me.xp
   or ched_lastname ~= me.name then
      ched_init=true
      ched_xp_init()
   end
      
   if (os.difftime(os.time(), ched_lasttick)>0) then --We need to run this once per second
      ched_xp_next_level = (req_xp[(ched_currentlvl+1)]-me.xp)
      if ched_xp_next_level < 0 then --To account for non-meditated levels
         ched_currentlvl = ched_currentlvl + 1
      end
      
      local xpperminuteftotal = 0
      local xpperminutettotal = 0
      for i=1,300 do --5 to 10 minutes back
         ched_xp_arr[(600-(i-1))]=ched_xp_arr[(600-i)]
         xpperminutettotal=xpperminutettotal+ched_xp_arr[(600-(i-1))]
      end
      for i=1,299 do --0 to 5 minutes back
         ched_xp_arr[(300-(i-1))]=ched_xp_arr[(300-i)]
         xpperminuteftotal=xpperminuteftotal+ched_xp_arr[(300-(i-1))]
      end
      ched_xp_arr[1]=me.xp-ched_xp_lasttickxp
      xpperminuteftotal=xpperminuteftotal+ched_xp_arr[1]
      xpperminutettotal=xpperminutettotal+xpperminuteftotal
      ched_xp_p_fmin = math.floor(xpperminuteftotal/5)
      ched_xp_p_tmin = math.floor(xpperminutettotal/10)
      ched_xp_lasttickxp = me.xp
      ched_lasttick=os.time()
   end
   

   auxbox_prop_line("XP to next level:", ched_xp_next_level)
   auxbox_prop_line("XP/min (10 mins):",string.format("%d(%d)",ched_xp_p_tmin,math.floor(ched_xp_next_level/ched_xp_p_tmin)))
   auxbox_prop_line("XP/min (5 mins):",string.format("%d(%d)",ched_xp_p_fmin,math.floor(ched_xp_next_level/ched_xp_p_fmin)))
   auxbox_prop_line("Last XP gain:", ched_lastxp)
end

-- explode(seperator, string)
-- from http://lua-users.org/wiki/SplitJoin
function explode(d,p)
  local t, ll
  t={}
  ll=0
  if(#p == 1) then return p end
    while true do
      l=string.find(p,d,ll+1,true) -- find the next d in the string
      if l~=nil then -- if "not not" found then..
        table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array.
        ll=l+1 -- save just after where we found it for searching next time.
      else
        table.insert(t, string.sub(p,ll)) -- Save what is left in our array.
        break -- Break at end, as it should be, according to the lua manual.
      end
    end
  return t
end

VERBOSE_DPS_REPORT = true
    last_dpst = g_dpst
    hits_recorded = 0
    dmg_log = {}
    median_damage = -1
    recent_hit_times = {}
    five_hit_intervals = {}
    median_interval = -1

    function auxbox_damage_per_second()
      local current_time
      local current_dmg
      local current_five_hit_interval
      local temp_var
      local temp_five_hit_intervals
      local temp_dmg_log
        if last_dpst ~= g_dpst then
          current_time = os.time()
          current_dmg = g_dpst - last_dpst
          hits_recorded = hits_recorded + 1
            if hits_recorded <= 30 then -- first 30 hits
              table.insert(dmg_log, 1, current_dmg)
            else -- on and after the 31st hit
              table.remove(dmg_log, 30)
              table.insert(dmg_log, 1, current_dmg)
            end
         
        last_dpst = g_dpst
            if hits_recorded < 6 then -- first 5 hits
              table.insert(recent_hit_times, 1, current_time)
            else -- on and after the 6th hit
              table.remove(recent_hit_times, 5)
              table.insert(recent_hit_times, 1, current_time)
            end
         
          if hits_recorded >= 5 then
              current_five_hit_interval = recent_hit_times[1] - recent_hit_times[5]
                if hits_recorded <= 35 then -- first 30 "5 hit" intervals
                  table.insert(five_hit_intervals, 1, current_five_hit_interval)
                else -- on and after the 31st "5 hit" interval
                  table.remove(five_hit_intervals, 30)
                  table.insert(five_hit_intervals, 1, current_five_hit_interval)
                end
            end
        end
       
      if hits_recorded < 35 then
          temp_var = 35 - hits_recorded
          auxbox_prop_line("DPS:", string.format("...in %d hits...", temp_var))
          if VERBOSE_DPS_REPORT then auxbox_prop_line("Median Damage:", "") end
          if VERBOSE_DPS_REPORT then auxbox_prop_line("Median 5-Hit Time:", "") end
        else
          temp_dmg_log = {}
            for i,v in pairs(dmg_log) do
              temp_dmg_log[i] = v
            end
         
        table.sort(temp_dmg_log)
          temp_five_hit_intervals = {}
            for i,v in pairs(five_hit_intervals) do
              temp_five_hit_intervals[i] = v
            end
         
        table.sort(temp_five_hit_intervals)
          median_damage = math.ceil((temp_dmg_log[15] + temp_dmg_log[16]) / 2)
          median_interval = math.floor((temp_five_hit_intervals[15] + temp_five_hit_intervals[16]) / 2)
          temp_var = math.floor((median_damage * 5) / median_interval)
          auxbox_prop_line("DPS:", string.format("%d", temp_var))
            if VERBOSE_DPS_REPORT then
              auxbox_prop_line("Median Damage:", string.format("%d", median_damage))
            end
            if VERBOSE_DPS_REPORT then
              auxbox_prop_line("Median 5-Hit Time:", string.format("%d", median_interval))
            end
        end
    end
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
Bugbo
Girls only want boyfriends who have great skills.
Posts: 795
Joined: Thu May 06, 2004 8:45 pm
Location: Oregon!
Contact:

Re: Custom Auxbox Creations

Post by Bugbo »

Can the code be used to play sounds?
brentoboy
LAUGHING OUT LOUD LIKE A MORON
Posts: 73
Joined: Thu Jul 05, 2012 1:39 pm

Re: Custom Auxbox Creations

Post by brentoboy »

@bugbo
probably not.

I mean ... sure, you can do pretty much anything you can do with lua. And it looks like there are some ways to play sound from lua, but judging from this post on stack overflow ... it isn't going to be simple and straightforward.

http://stackoverflow.com/questions/5365 ... und-in-lua

@cia, @turtle
the skills section(s) are working in the script I have running on my box right now.
It also uses a config file for each of my alts, to show different stuff depending on who I'm playing.

I need to sit down and pull together recent changes posted by everyone else so I have the latest version of all of the scripts. I just haven't had the itch to do development for the last week or so.

Here is my current script, with some example alt specific configs.

The list of sections that can be put into the alt config files can be found down at the very end of the auxbox script.
You do not have the required permissions to view the files attached to this post.
PD: Duncan
Reg: Zen / Natasha
Loughf
LAUGHING OUT LOUD LIKE A MORON
Posts: 63
Joined: Fri May 10, 2013 9:24 am

Re: Custom Auxbox Creations

Post by Loughf »

that's awesome, having a different screen for each alt.
User avatar
CIAassassin
Posting from my ass computer.
Posts: 606
Joined: Thu Oct 26, 2006 10:34 am

Re: Custom Auxbox Creations

Post by CIAassassin »

@Brent see this thread for all of the completed codes, and most recent codes. I have yours in there with only the dynamic skills, ie the one that removes a skill after it reaches 100%. The rest of the codes just didn't like me messing around with them.

I still need to tinker around and get the codes for setting up an alt put on that thread. Just been busy, and trying to not do three things at once. Now that I look at it you have a different format than Ive seen before. You call your functions outside of the auxbox() and Im not sure about the bottom of that code.
Rikimaru

"Oh, you're a lesbian? That's cool, I'm a lesbian trapped in a mans body, we should date."
Post Reply