Author Topic: Kali's Bod Sorter for openEUO  (Read 79864 times)

0 Members and 1 Guest are viewing this topic.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Kali's Bod Sorter for openEUO
« on: January 07, 2013, 07:18:19 AM »
0
Kali's Bod Sorter

Code: [Select]
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-- Script Name: KaliBodSorter.lua
-- Author: Kali of LS
-- Version: 2.61
-- Client Tested with: 7.0.29.2  
-- EUO version tested with: OpenEUO 0.91.0029
-- Shard OSI / FS: OSI
-- Revision Date: February 6, 2013
-- Public Release: January 7, 2013
-- Purpose: Sort bods into books based on reward
-- Dependencies: Kalilib.lua
--     http://www.easyuo.com/forum/viewtopic.php?t=48699
--               bodsorterindex.lua
--     Attached in script thread
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

WARNING
1.  This script is for openEUO!!  Do not run this in EUOX!
2.  If you do not have the two dependency files, this script will not run!

Features
1.  Script will sort all bods in all books from user targeted bag(s).
2.  Script will sort all bods into books in separate user targeted bag(s).
3.  The script sorts bods based on reward outcome as described below OR user through defined index

Instructions
1.  Go to easyUO and download my script library (I'm still trying to talk TM into giving me a spot in the library thread section :p ) and place in openEUO scripts directiory.
    http://www.easyuo.com/forum/viewtopic.php?t=48699
2.  Download and put KaliBodSorter.lua and bodsorterindex.lua into openEUO scripts folder
3.  The script sorts into books based on string matching in bod book name.  So have a book with the following names in the sort into container:
Smithing Bod Books
'120 Smith PS'
'60 ASH'
'30 ASH'
'Valorite Runic'
'Verite Runic'
'Agapite Runic'
'Gold Runic'
'Bronze Runic'
'Copper Runic'
'Smith Trash' --Larges that give poor rewards
'Smith Turn In' --smalls that belong to larges that give poor rewards.  Ready for recycling

Tailoring
'CBD'
'120 Tailor PS'
'Horned Kit'
'Barbed Kit'
'Spined Kit'
'Tailor Trash' --same as above + Bone Smalls.  Didn't feel like collecting bones long ago, but now that you can buy them... might change this
'Tailor Turn In' --same as above

note* If you wish to lump any together, simply name the book with both names, i.e. 'Spined Kit Horned Kit' will work to collect bods whose rewards are either.

If you download KaliBodIndexCreator.lua, you can use that script to create your own sorting index.  I will describe it below.

4.  Script Automatically calculates how many bods you can hold in your pack based on current source book's bod count, item pack count, and greatest reward book bod count.

5.  Do not have a near full pack such that you couldn't hold your source books to begin with.

6.  User defined variables:
Code: [Select]

--=======================================================================--
-- User defined variables
--=======================================================================--
local fName = "bodsorterindex.lua"           --Index file name                              
local lagOffset = 0                          --ms offset if you have slow connection
local MaxBookCnt = 500                       --Set this to a specific value if you want less than 500 bods/book                                                                                        
--Optional hardcoded setup
local sBagID = nil                           --Bag with bodbooks to sort
local dBagID = nil                           --Bag(s) with reward bodbooks
--If you wish to set more than one reward bag, set it as a table:
-- { bag1ID, bag2ID, ... }
--=======================================================================--
fName is the file name of the index you wish to sort.  This file MUST be placed in the SCRIPTS folder in the openEUO directory.  You can add a subdirectory via naming it such:  "SubDir/bodsorterindex.lua" or "SubDir/AnotherSubDir/WhyWouldIDoThis/MyIndex.sav", etc...
You can adjust the lagOffset if you experience journal message 'you must wait'... It is in ms, so 250 = 1/4 of a second.
sBagID and dBagID can be hard coded to avoid targeting setup during run time.

If you experience any 'you must wait' messages or client crashes, please start adjusting lagOffset 100-500 ms before posting.  It helps me track down the bugs.

7.  Script will sort tailor and smith bods at the same time.

8.  Stand within 2 tiles of all bod book containing pouches you wish to use.  Press play
    a)  First is source bag setup.  For each bag you want to add, you press f2, target a bag, finally press f3 when you've added all bags.
    b)  Second is reward bag setup.  Just like above, f2 to add a reward pouch, f3 to start the script.

9.  Sit back, grab a glass of water, a pale ale (or [double] india pale ale), a gin and tonic, or a glass of hot cocoa (I will not and never advocate soda, not even diet).  

------Update Details------
Updated 2-6-13
Fixed a typo in the dofile line causing the script to halt.

Updated 2-4-13
v2.60
Modified the entire empty routine to improve stability.  If you find this incredibly more stable, we can play around with wait times to optimize speed.  
Slowed down the emptying routine so each bod takes 200 ms longer to empty, doesn't seem like much, but if sorting 5k bods, that is 1000 seconds longer.  (~15 minutes).
If you assign multiple reward bags, and you over fill a book, instead of the client crashing or the script bugging, the script will search for a reward bag that can hold the book.  If it can find one, it will just stash the book there for the remainder of the sorting.  If it cannot, the script will throw an error and stop.  

Updated 1-20-13
v2.50
Modified two subs that would rapidly send commands to the client, potentially causing client crashes on some machines.
I've increased wait time between clicking, and added a wait between drag and drop commands.
I've added a new user defined variable, default is 500, but you  may choose a smaller number of bods to be put into each reward book.
Pretty little done message when you've finished sorting :)

v2.20
Modified bag setup.  Now, bags open after all bags chosen.  
Modified spacing between bags so the contpos values are extremely outside the game window if you have more than a few bags.
Added a reset filter function so bod books are reset once before emptying.
Tested on 3.5k bods, no disconnects.


Updated 1-15-13
Uploaded index creator.
Modified user variables to include option for user generated index file.
Modified one line of code to see if it helps improve connection loss issues.

Updated 1-14-13
KaliBodSorter.lua
v2.0  
Added multibag support.  Added lag support.  Added automatic bod counting for optimization of run time.

bodsorterindex.lua
Added smith/tailor specific strings, a necessary result of multi-reward bag support.

bodindexcreator.lua
used to create the most recent sorter index.

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

Notes
I have written a bodindexcreator script that I have also supplied which will generate a default index: bodindexsorter.lua
I've also supplied KaliBodIndexCreator.lua which is a menu driven script to create an user defined index.

When I get the motivation, I plan to release an update version of this and a bod swapper for openEUO as well.  If you have any problems, post in this thread AND send me a PM so that I am aware my attention is needed.

Menu Driven Index Creator
If you use KaliBodIndexCreator.lua to create a menu, you can customized the script's sorting behavior!  The menu is simple and easy to use.
Script is stand alone, load it openEUO, press play.
1. You can load a previously made index for modification or start a new one.

2. Creating Bins:

You can then create bins via the 'Add Bin' button.  The string in the edit box will be the string the script searches for in the BOD Book Name during sort.  The first  bin becomes the default bin, and all bods are initially set up to enter that bin.  You can create as many bins as you'd like.  If you make a mistake, just don't put any bods in that bin, and it won't be used. Furthermore, if you reload the index later, that bin will not even show up.  

You can save the index at any time via the save button.  If you have any unassigned bins, it will print a debug message in oEUO window.  

You can return to the main menu via the return button.  The script will prompt with a menu if you have unassigned bins and/or if you have not saved the index after making any changes.

3.  Modifying bins

Click the button correspond to the bin you wish to modify.  It will open a new window:


The top box is for the current bin, the bottom for all bods.  There is a filter for each box on the left.  You can filter the bods in the list virtually any way you'd like.  You can add bods via the add button, and remove them from the bin via the remove button.  The list box and buttons support multiselection for facile index creation.  If you click the return button without saving, you'll be prompted to save the bin if you've made changes since the last save.

4.  You all owe me a valorite runic hammer on Lake Superior.

There are 4 attachment(s) in this post. You must register and post an acceptable introduction to download
bodindexcreator.lua
bodsorterindex.lua
kalibodindexcreator.lua
kalibodsorter.lua
« Last Edit: February 06, 2013, 07:29:47 PM by KaliOfLS »
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #1 on: January 07, 2013, 08:22:01 AM »
0
Have the script running as i am typing, Would love to see it sort all bods rather than just the top 4, Spined kits sell for 400k here so not to be sniffed at :)

Working well, will let you know how i get on.

Nel.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #2 on: January 07, 2013, 08:26:10 AM »
0
Ok, I was thinking about reworking this to save spinned kits due to an increase usage with runic reforging.  I'll update later when I get a chance.  I'll shoot you a pm or something.
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #3 on: January 07, 2013, 08:30:55 AM »
0
That's a must-do.  Those spined kits are particularly useful for low-level runic reforging.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #4 on: January 07, 2013, 08:37:09 AM »
0
Updated the index and index creator files to save Spined Runic bods as well.
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #5 on: January 07, 2013, 08:43:34 AM »
0
Just did 1st 400+ bods, got 350'ish turn in, 07 120 PS, 12 CBD, 15 HRK and 0 BRK, Will save the turn in and trash until it has support for SRK's. (you put in support whilst i was typing will run now)

I need to turn down the speed a little as it keeps giving the message "You must wait to perform another action" i am guessing that's just Altering "Wait 250" to "Wait 500"

Worked really fast with very few errors (Only caused by speed)

Nel.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #6 on: January 07, 2013, 08:50:53 AM »
0
Oh, that will be fixed in my updated release.  I have screaming internet (24 MBit)  heh.   
All the drag/drops have a 1 second wait and is the mandatory wait time between actions on OSI.  I have to go to work, but in the newer, uncompleted version I have a function that handles all drag drops, but in this one, there are several places that you can modify:

Lines:  354,369,391,418,425, and 433
I'd suggest adding a 1/4 of a second (change 1000 to 1250) since it seems that you are right on the cusp of this.  In the future release, like I said, I have one function that will handle all drag/drops and I'll have a user defined variable at the top called LagOffset that will allow users to add an additional waiting buffer to the script waits.

Glad it seems to be working for you.  I've used it about 20 times now and the rewards have always been spot on.  Please tell me if find a situation in which the script was wrong.
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #7 on: January 07, 2013, 11:04:29 AM »
0
Ok, Been running this for a while now. It runs really well with only 1 minor hiccup, every now and again a bod gets left behind in the bag, no biggie can just add it to the next bag.

I think a few things would make the script better (IMO)

Support for all rewards - Can pick which to upgrade to get next best rewards ect
Separate bags for each book - This way you wont have to switch out the books so often.

Overall very good script.

Nel.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #8 on: January 07, 2013, 11:28:49 AM »
0
Yeah, because of the menu bugs in oEUO, I never finished the support for user defined separation.  I'm not sure if you have any script experience or not, but the bodindexcreator.lua is well organized if you look, and you can just modify those if you'd like.  However, if you're patient, this week I can get around to creating the menu driven index creator that allows you to save your own index file and use it in place of my supplied one.

Yeah, I noticed today I had a bod chillin out in my backpack.  This doesn't happen all the time, I will look into it and update you when I'm finished. 

Since I've posted this script, I now have motivation to update it for usability and fidelity :)

Also, can you clarify:
"Separate bags for each book"? 
Do you mean, allow multiple bags for full books or the books you're sorting into.

I keep alluding to a new version that I am working on, and in this new version, it allows you target multiple containers for reward books because I ran into this problem that my reward bag gets full.  So I guess I really need to finish the updated version.  Now priority on the list.
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #9 on: January 07, 2013, 12:06:50 PM »
0
"Separate bags for each book" So PS 20 book in 1 bag, CBD in another bag and so on so if there are 8 rewards you have 8 bags, when one bodbook gets close to full you can switch it out.

As for Scripting Knowledge, i can change wait times, break them, sometimes get lucky and get the right answer... but mostly i just break scripts that i mess with. but saying that, i saved the 1st version of the script you put out, so if i look at that against the 2nd version i might be able to work out what i need to change to add the other things, we shall see :)

Nel.

p.s. i am still getting a wait time error, changing all the 1000's to 1250 or 1750 did not help, It's where the full bodbook drops into the backpack and the script tries to open the book strait away.
« Last Edit: January 07, 2013, 12:15:15 PM by Nellie »

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #10 on: January 07, 2013, 10:46:55 PM »
0
Oh wow, I just looked at the script, I am absolutely shocked this didn't even cause a problem for me, but it seems I must have lost a wait in there somewhere, on line 251, Add "wait(1250)", right underneath where you find "UO.DropC(UO.BackpackID)" (no quotes).

Also, I'm working on the index creator for you.  I'll update the sorter afterwards as it is working pretty well.  I also forgot to mention, you can have the bods fall into the same books if you want for isntance, if you want both bronze and gold runics in the same book, you just name the book "Bronze Runic Gold Runic". 


R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #11 on: January 08, 2013, 04:12:32 AM »
0
That wait did the trick :), Also i dont seem to be getting the odd bod left in backpack, so that might have sorted that problem too.

I changed the count so that it takes 40 from a book instead of 20, but noticed that it takes 39 (Guessing it takes 19 when it says 20) and nearly always leaves the last bod in the book. When the message says 1 bod in book, it gives the message "you must wait to perform another action" then drops the last bod. (Again not a biggie it gets the job done eventually, but i know u guys like feedback).

Thanks again for the work you have done on this script, it's defo a time saver and i bet a lot of others will also appreciate it when they find it. :)

I wouldn't even attempt to sort out my 15+k bods without it :D

Nel.

Offline Nellie

  • Full Member
  • ***
  • Posts: 144
  • Activity:
    0%
  • Reputation Power: 2
  • Nellie has no influence.
  • Gender: Male
  • Respect: +21
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #12 on: January 09, 2013, 06:29:18 AM »
0
Just finishing my last 400 bods and then all the bods i had that weren't in named books have been sorted (not sure how many but circa 7 - 8k i think) Took about 10 hours over 3 days to do them, still have 3.5k Smithy bods to sort, but i dont really do smithy bods so they can wait.

There was only 1 thing that really slowed me down whilst doing the sorting and that was having to change all the books in the sorted bag after every sorting process (then combine all the smaller part filled books). If possible i think 1 book per bag would be better as this would mean you would only have to change the books whenever they get full.

Overall a very good script(would give it 9.5/10 in its current state), Cant wait for the ability to sort all bods then decide which i want to discard. (will this script be posted on the other site too?)

Nel.

Offline KaliOfLSTopic starter

  • That's "Dr." Kali to you!
  • Sr. Member
  • *
  • Posts: 406
  • Activity:
    0%
  • Reputation Power: 6
  • KaliOfLS has no influence.
  • Gender: Male
  • Respect: +33
  • Referrals: 2
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #13 on: January 09, 2013, 06:36:03 AM »
0
Awesome.  I'm currently working on a GUI for the index creator.  I'm about, I'd say, half way done with it.  Since there is a total of about 600 unique bods, I'm creating a way for you to filter the bod list to make it easier for users to add items to 'bins'.  The menu will work like this (Load/New Index), then it will pop a window of all the bins in your index (obviously a new one will have 0 bins).  You can then create a bin, the bin will be the string that is used to match against the names of books.  Then when you click the bin button, you can modify which bods are sorted into that bin. 

Anyway, I'm working on the filtering aspect, and once I have that down, it shouldn't be too much more to finish it off.  :)  Next thing will be to make the addition for more bod reward bags.                                   
R~~~~ B~~~~~~~~ 
^ real life signature for sure

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Kali's Bod Sorter for openEUO
« Reply #14 on: January 09, 2013, 09:29:40 AM »
0
Will you be able to sort books like this: 3 books for Leather (  N&E 10,  N&E 15, N&E 20) 3 books for Spined (  N&E 10,  N&E 15, N&E 20).   To be honest I'm still trying to figure how to sort those BOD.  I figure that if I organized  wit multiple books it should be easier to find what I need. 

P.S.  Still didn't have time to  your at 100%,  limited internet for now :(

Tags: Bods  Bod