Kali's Bod Sorter-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-- 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
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
WARNING1. 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!
Features1. 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
Instructions1. 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:
--=======================================================================--
-- 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
![Smiley :)](http://www.scriptuo.com/Smileys/yarex2/smiley.gif)
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.
------------------------------------------------------------
NotesI 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 CreatorIf 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:
![](http://img6.imageshack.us/img6/9600/binq.png)
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.