Auto-Loot (v 1.3.5): A loot gathering script with combat support.

Copyright (c) 2002, 2003 by David A. Down (Merlyn of Harvestion), 6/3/2003.

Contributions: I am currently unemployed. If you find Auto-Loot useful, I would greatly appreciate any donations to help me keep improving Auto-Loot. The easiest way is with Pay me securely through PayPal! to dadown@cox.net, thanks.

Copying code: If you use code from my program, please give me credit for it in the comments.


Features of Auto-loot:


How to use Auto-loot:

Setup:
Auto-Loot uses commands in JScript version 5.5 (comes with MS IE 5.5) and will get a compile error if you try to use it with an earlier version. It also needs Skunkworks version 2.4 or later and Decal version 2.5.2 or later. You should have at least 256mb of RAM or performance will suffer when running Decal plugins.
 
Put the contents of the Auto-Loot .zip file in the "Libraries" folder under the Skunkworks folder. You can put it in a different folder, but you will probably have to browse for it with the Skunkworks console before Skunkworks lists it on its drop-down selection menu.
 
Warning: You can change the default settings by editing the .js file, but if you make a mistake, you will get runtime errors. To be safe, make backup copies of the files before editing in case something goes wrong. After configuring, the settings for a particular character can be saved and will be restored the next time this character is played.
 
Starting:
You must have Skunkworks running under Decal when you log into AC in order to run Auto-Loot. Open the Skunkworks window and select Auto-Loot.swx from the drop-down list in the Script tab (Use the Skunkworks console to locate it if it isn't showing up). Click on the Go button to start running and Stop to quit.
 
When Auto-Loot starts, it will check for a pack containing scarabs. If one is found, all scarabs added to the main pack will automatically be moved to the scarab pack and scarab loot will be moved there directly. It also checks for elixirs and potions and will collect any types that are found. If settings have been saved for this character, they will be restored instead of using the defaults.

To track spells and scrolls, log on your first character to track and then start Auto-Loot from the Skunkworks script menu window. Auto-Loot will notice that no configuration exists and will automatically built a character and spell table. When it has finished, log out your character without stopping Auto-Loot and log in your next character (only ones on the same server and account). When logged in, your next character will automatically be added also. Continue switching characters until you get to the last character on this server and then click on the Save Spell List button to create a spell configuration file fo this server.

If you have play on multiple servers or have multiple zone accounts, repeat for each account and/or server. When finished any character will be able to check on all other characters on the same server.
Running:
All commands to Auto-Loot are supported via text commands and many are available in a Decal window also. All feedback from Auto-Loot will be displayed in the text window with a "Auto-Loot" prefix (unless in debug mode). Commands can either be entered in the Skunkworks Command tab or as a chat message with a "/sw " prefix.
 
As an example, to request Auto-Loot to display the current minimum loot value, type the following on your keyboard: <press return> /sw value <press return>
 
Commands that are used a lot can be tied to a hot-key to minimize typing.
 
Stopping:
Auto-Loot will automatically pause when your character logs off and will quit if you exit the AC client. You can also stop it with the "quit" command or by clicking the Stop button on the Skunkworks Script tab. When you log back in, it will resume and retain most configuration settings. If you log in with a character that has settings saved, those settings will be restored.

Commands to Auto-loot:

all
*Toggles the Loot-All flag. When on, it loots everyone's kills. (See below for details.)
armor
Displays the current armor loot setting.
armor <#>
Sets the minimum AL armor to loot (0 to disable). This includes shields.
auto
*Toggles the Auto-Mode flag. When on, it cycles modes between kill, loot and ammo.
buy
*Buys as many of the currently selected casino token as possible.
buy <#>
*Buys the specified # of the currently selected casino token (if possible).
cantrip
Toggles the cantrip flag. When on, items with minor spells will be looted. Items with major spells are always looted.
carve
Attempts to carve any golem hearts in your inventory. You must have the lockpick skill and be carrying an Intricate Carving Tool before you can carve hearts. Buff your skill before using the command.
chars
Display the names of the characters that Auto-Loot has been configured for.
chat
Toggles the Chat-Message flag. When on, all messages are said as chat messages.
chat <prefix>
Set the Chat-Message flag and prefixes chat messages with the given string, i.e. "/f".
check
Check the currently selected scroll and display who can use it.
check loot
Toggles the check-loot flag. When on, scroll are only looted if they can be used by a configured char.
corpses
Displays the current list of corpses to be evaluated.
cso
Displays the location and distance to the currently selected object (cso).
deb
Toggles the debug flag. When on, Auto-Loot sends output as debug messages.
dist <location>
Displays the distance and heading to the specified location.
eat
*Toggles the auto-eat flag. When on, Auto-Loot will eat food loot if low on stamina/health/mana.
eat <#>
*Set the percent at which stamina/health/mana is considered low.
eval <expression>
For debugging use. Evaluates the JScript expression and returns the result.
find
*Toggles the find flag. When on, Auto-Loot will try to find things to kill beyond radar range.
fish
Start fishing at a nearby fishing hole. Requires a rod and licence. Continues until stopped.
Minnows are returned to the hole and low value loot is dropped. Fish are stacked.
fish sell
Sells all fish in inventory to the Tackle Master who must be close to the player.
friends
*Displays a list of friends logons/logoffs since Auto-Loot was started.
go <location>
*Runs to the specified location, i.e., "25.4n 57.3e" or a named location.
hold
Displays a count of corpses on the hold list to be checked next loot cycle.
home
Sets the current location as the home location for Auto mode.
home clear
Clears the home location for Auto mode.
home <location>
Sets the specified location as the home location for Auto mode. Use 'clear' as the location to reset.
hot
*Toggles the hot-key flag. When on, configured keys will run a command when pressed.
id
Displays the id and classification information for the currently selected object.
key
Displays the currently defined hot-keys.
key <key>
Removes the definition for <key>.
key <key> <command>
Defines <key> as <command>. When hot-keys are enabled, pressing <key> will run the command.
Default key definitions are 'K'='kill' and 'L'=loot.
kill
*Goes into combat mode and attacks all targets in range.
list
*List all the scrolls being carried and which characters can use them.
Note: If a container is selected, only the container contents will be examined.
list <name>
*List all the scrolls being carried that can be used by <name>.
locate <name>
Scan the vicinity for the named object, select it and display the distance and heading if found. Only the first match found is listed. The name can include one '*' to make a template.
log
Toggles the log flag. When on, Auto-Loot will display more detailed messages.
loot
*Loot unopened kills. (See below for details.)
loot add
Add the currently selected item to your loot list.
loot add <name>
Add the name to your loot list (be sure the name is exact, caps included).
loot attack
*Toggles the attack flag. When on, Auto-Loot will loot even while being attacked.
loot list
List all the items in your loot list.
loot rem
Remove the currently selected item from your loot list.
loot rem <name>
Remove the name from your loot list (be sure the name is exact, caps included).
loot save
Save your loot list. Be sure to save when done making changes.
loot wait
Displays the current maximum loot ID wait time.
loot wait <#>
Sets the maximum loot ID wait time in milliseconds.
looting
*Toggles the looting flag. When on, Auto-Loot will loot any opened contained and will stack any item moved to your main pack (also eat items if eat flag is on and low on vitals).
mat
Displays the list of material types to loot.
mat <name>
Removes <name> from the list of material types to loot. Be sure to save the configuration if you want to make this change permanent.
mat <name> <#>
Adds <name> to the list of material types to loot. Items with workmanship of at least <#> will be looted. Be sure to save the configuration if you want to make this change permanent.
move
*Move any unusable scrolls to the currently selected destination.
move <name>
*Move any scrolls usable by <name> to the currently selected destination.
npc
*Lists all detectable monsters in the area. including level and xp value if available.
npc list <#>
Lists all known monsters of the specified level (if the monster database is avalable).
npc list <name>
Lists all known monsters matching the name template (if the monster database is avalable).
npc new
Creates a new, empty monster database. Remember to save to disk when done.
npc save
Saves the current monster database to disk.
one
*Toggles the one-target flag. When on, Auto-Loot will only act on one target per command.
quit
*Sets a flag to stop running Auto-Loot when the current action completes.
range
Displays the current maximum range in map units for killing, looting and collecting. The edge of radar is 30 outdoors and 10 indoors. (These values are scaled by 100 to eliminate decimals.)
range <#>
*Sets the maximum range for killing, looting and collecting.
ratio
Displays current minimum value to weight ratio for loot.
ratio <#>
*Sets the minimum value to weight ratio for loot.
salvage
Opens the salvage window and moves in the first item type that matches the 'mat' settings. The cursor is moved to the salvage button, but not clicked. Only the main pack is checked.
salvage all
Opens the salvage window and proceeds to automatically salvage all items of the configured material types. *** Warning: This command can salvage valuable items without checks. Use with caution.
salvage auto
*Toggles the auto-salvage flag. When on, Auto-Loot will automatically salvage any loot items that were looted due to workmanship as soon as the loot operation is complete. *Use with caution!*
salvage list
Displays the loot items that will be salvaged by the salvage loot command.
salvage loot
*Opens the salvage window and salvages all loot items that were looted due to workmanship.
save
*Saves the configuration settings for the current character to "Auto-Loot.cfg".
savesp
*Saves the current spell list to "Auto-Loot@<server>.cfg".
scan
*Scan the area for corpses and rebuild the corpse list.
scarab
Displays the current minimum scarab level to loot.
scarab <#>
*Sets the minimum scarab level to loot.
scroll
Displays the current minimum scroll level to loot.
scroll <#>
*Sets the minimum scroll level to loot.
sell
*Move items in your main pack to the current vendor window (must be open).
Only uninscribed items that the current vendor accepts will be moved.
sell <#>
Only sells items from the first # rows of your pack.
skills
Display the magic skills known by the current character.
skills <name>
Display the magic skills known by <name>.
sort
Sorts the contents of your main pack by value. Pyreals, scrolls, inscribed items and items on the loot list are not included in the sort. Low value items will sort to the top of your pack.
sort <#>
Sorts the first # rows of your main pack by value.
sort <#> w
Sorts the first # rows of your main pack by weight.
sort <#> vw
Sorts the first # rows of your main pack by value/weight.
speed
Run forward for 15 seconds and display your current running speed.
spells
Update the spells known by the current character in the spell list.
stack
*Stacks the pyreals in the main pack to use the fewest slots.
stop
*Stops the current actions.
tank
*Toggles the Tank-Support flag. When on, Auto-Loot expects El Tank to be running to handle mage combat. Auto-Loot does not support spell casting directly.
tank <#>
Sets the Tank-Support flag and sets the timeout to # seconds (default is 7).
token
*All casino tokens in inventory will be turned in to the nearest appropriate gamemaster. There must be an unabstructed path to the gamemaster. This command will abort if the main pack if full.
tusk
*Enables picking up the next tusker tusk or olthoi pincer found as loot. Only one will be looted per enable.
unlock
Unlock any locked Mnemosynes found in inventory. The appropriate key must also be in inventory.
value
Displays the current minimum item value to loot.
value
*Sets the current minimum item value to loot.
weapon
Displays the list of weapons configured for looting.
weapon <name>
Removes the named weapon from the list.
weapon <name> <#>
Adds the named weapon to the list of weapons to loot and sets the minimum damage to #. Valid weapon names are: Axe, Bow, Crossbow, Dagger, Mace, Spear, Staff, Sword, Thrown, Unarmed
xp
*Toggles the XP-Message flag. When on, xp gains from kills and skill use will be displayed.
If logging is also on, all xp changes will be listed in detail.

Note: Commands with an '*' can be issued by just clicking on the appropriate button in the Decal Auto-Loot window. When editing a numeric setting, the Enter key must be pressed for the change to take effect.


Notes on command usage:

Killing:
Auto-Loot will detect the type of weapon wielded and will run to within charging range when in melee mode. When using a ranged weapon, killing will be stopped if all ammo is used up. Magic attacks are only supported in conjunction with El Tank.
 
When auto-mode is enabled, killing will be suspended when all target in range have been killed or when in melee mode if all targets in charge range have been killed. When in tank mode, killing is suspended when Tank has been idle for at least 7 seconds and there are corpses to check.
Looting:
By default, Auto-Loot only opens corpses from your kills. With the 'all' command, you can enable looting all corpses in the area. Auto-Loot won't visit a corpse that has already been opened (by you). Auto-Loot will always pick the closest valid corpse to open next. If attacked when looting, looting will stop and auto-mode will switch to killing.
 
When you open a corpse (either manually or automatically), Auto-Loot will loot any items that match its loot settings. First, any item that is on the list of named loot like shards, keys, motes, etc. Then, any scarabs or scrolls that are not below the minimum setting are looted. Any item made of a desirable material that is of high enough workmanship is looted. Then if the item has enough value and doesn't weigh too much it is looted. Finally, if the 'eat' flag is set and a vital is low, the food item/potion will be looted and eaten.
 
When deciding whether to open a corpse, Auto-Loot first makes sure that it hasn't been opened already. Then it checks to see if it is in range from where the loot command was given. Next, if the 'all' option wasn't used, it checks to see if it is your kill. If it passes all the checks, the corpse will then be opened (if possible). After it has been opened, it will be removed form the corpse list and added to the opened list. If a corpse can't be opened, it will be put on a hold list and retried the on the next loot command.
 
You can use the commands 'loot add' and 'loot rem' to modify the default loot list. Be sure to do 'loot save' after you are finished. You can also edit the Auto-Loot.loot file directly, but be careful to preserve the syntax and note that there is no comma after the last item in the list.
Collecting:
When auto-mode is on with a ranged weapon, after looting is done any spent ammo left on the ground will be collected if it is withing range. If attacked when collecting ammo, collection will stop and auto-mode will switch to killing.
Spells:
After you learn new spells, use the 'spells' command to update the list of known spells. Use the 'savesp' command before quitting to remember the updated list.
Moving scrolls:
The 'move' command is use to select and move a set of scrolls. You must select a destination before issuing the command by clicking on it. Scrolls can be moved to a pack or chest or given to a player or vendor (to sell). If you don't specify a character name with the move command, only scrolls that none of your characters can use will be selected. If you specify a name, only scrolls usable by that character will be selected.
Go locations:
On the 'Go' tab you can build a list of locations. Move to a location that you wish to add, click on the 'Add' button and you will be prompted to enter a name for the current location. When you add a location, it will be added to the end of the drop-down menu list. Be sure to save your configuration when you are finished changing your location list so that it will be available next login.

After you have a list of locations, you can select a location and click on the 'Go' button to automatically run to that location. There must be a direct path to that location for it to work properly. You can click on the 'Remove' button to remove the currently selected location from the list.
Progress bar:
At the top of the 'Cmds' window is a progress bar that indicates the percent of targets that have been processed. This applies to the commands kill, loot and ammo. If new kill targets appear while killing or someone else kills some, the progress bar may not show the correct percentage.
Target information:
When you select the 'Tgt' tab, the currently selected object will be identified by name. If it is a creature, its level and stats will be displayed (if available). If it is a monster and the monster database is active, the database data will be displayed if available or a new entry will be made. Skill and xp info can only be updated if XP logging is on (see the Settings tab). ***Be sure to save the database when done updating.***

'Atk' lists the target's attack skills and 'Def' lists the target's defensive skills. If the skills are displayed in Green, your corresponding skill is clearly superior, Yellow indicates similar skills and Red indicates that your skill is inferior. 'M' is for melee attack and defense, 'R' is for ranged attack and defense and 'W' (War) is for magic attack and defense. Weapon bufs are not included in the comparision.

If an attack skill type isn't listed for a target, either the target doesn't attack in that way or that type of attack hasn't been defended against. If a defensive skill type isn't listed for a target, then the target hasn't been sucessfully attacked with that skill type. The XP value of a target depends on the player's level, so in many cases this won't be known until you have gained xp by killing this type of target.

If a target has a known attack type vulnerability, it will be displayed. A new vulnerability can also be selected and saved to be displayed in the future for this type of target.
 

Known problems:

Auto-Loot may have problems in laggy environments. Repeat the loot command to visit any corpses that may have been missed due to lag. If there are a lot of items to loot on a corpse, lag can cause an item to be missed. Re-opening the corpse will loot any items missed the first time.
If you don't have at least 256mb RAM, performace will suffer (more is better). Other Decal plugins that ID objects (such as El Tank, Sixth Sense and Bandit Sight 2) can significanty slow looting operations because they compete with Auto-Loot for assess operations.
When buying a large number of components, some of them may not get sorted. This can also occur when there are many items looted from a corpse.
When a stack of scarabs, etc. becomes full, looting this item type will be slower and may fail.
When running, its possible to become stuck behind an object. Only the 'go' command attempts a recovery.
The one-target option may not stop after the first kill, depending on attack timing.
When shooting at a target, shooting will be suspended after 4 misses (not evades) to prevent endless shooting at a blocked target. Sometimes the misses just occur because the target is moving.
If you try to add more than 28 characters to a given sever configuration, the extra ones won't work. This limit is due to the number of bits available in a numeric variable in JScript.
If lag occurs when attempting to move scrolls, some scrolls may not get moved, even though Scrolls says they were. Just repeat the command to move what was missed.

If you have comments, suggestions or find program bugs, you can send email to dadown@cox.net