[EasyUO]TEST: KaianaUberLooter

If you make a Client-side script you can publish it here for other players to use
Locked
User avatar
Kaiana
Elder Scribe
Posts: 148
Joined: Mon Jul 13, 2009 3:07 pm

[EasyUO]TEST: KaianaUberLooter

Post by Kaiana »

Current Version = 0.91c - Be sure to go through the item setup menu again when updating version or the item changes will not be activated :)
This is the most complex script I have undertaken to date. I've been working on it for a long time, and will probably still be working on it for a good while.

It's meant to be a be-all end-all looter program. It loots corpses, chests, and your own inventory of desired items and sorts them into three bags(may one day be expanded to any number). You choose what items to loot and where to loot them. I designed this script initially because most common looting scripts do not make use of the holding bags available on excelsior, and I wanted one that did.

This is far from complete, which is why I marked it test. I want any comments, questions, or issues posted here should they arise. I also want ideas to make it better. I intend to add functions for automatically smelting ore that is found anywhere(for example, when you mine ore falls into your pack, and since this program sorts your pack too, it can be made to function like that), putting metals and wood onto keys automatically, and adding custom item lists for looting. I will also someday likely integrate my [claim script into this one, provided I can get this one working perfectly. There may be more ideas that I have later, but for now that's all.

Loots: (green = available in the next release, blue = newest additions to script available below)
-Gold
-Oints/Essences
-Champ Skulls (obsolete, will remove soon)
-Garg Axes, Knives, and Picks
-Peerless Keys (Travesty, Crypt Key, Effusion/Parox/Dreadhorn Keys)
-Recipe Scrolls
-Ore/Logs/Boards
-Runic Tools
-Jewels
-Quest Stacks (such as Zoogi Fungus)
-Trans-Powder Items (Pet Summon Ball, Bracelet of Binding)
-Mage and Druid Regs
-Peerless Stackables (such as Eye of Travesty, Corruption, Elven Notes, etc)
-Peerless Nonstackables (such as Dog Imprisoned In A Crystal, Crimson Cincture, etc)
-Every Single Item in the Mage Quest
-Arrows
-Arcane Gems
-Seeds

Items/Features Yet To Be Added:
-Bones
-Necro Regs
-Para Chest Auto-Open
-Autosmelting using Mobile Forge
-Auto-add items to keys (this is now on the menu but does nothing yet)
-Item Evaluation (this may be a ways off yet)
-"Scavenger" element to search nearby ground as well.
-Ideas?

Changes made:
-Moved Parox spawning items to Peerless Keys section
-Added a "save" button to the options screen so you don't have to look at your item selections every time you change options.
-Added three new options. Loot During Battle, which if checked will cause the script to not wait if you currently have a battle target. Use Lockpicks Instead of Magic, which allows you to use lockpicks over the traditional magical approach when a locked chest is encountered. And...Auto-Add Items to Keys, which after each looting cycle adds any found items that can be keyed to their respective keys. This of course required...
-Added a setup for getting the IDs of your keys. The script will automatically detect them in your main pack. If you don't keep your keys there it won't detect them...if I figure out the issue I'm having with using items in closed bags I'll change that.
-"Locked Down & Secure" chests will no longer be targeted by the chest looting phase :)
-If the topmost corpse that is open is the one the script stopped looting because of some condition(like having a target or something), it will no longer try to re-open the corpse, saving a little time and processing by the server :)
-Removed Glacial Staff from loot list...it's common and not that great.
-Fixed a bug that was picking up rings that had the same type as Sabrix Eye.
-Added a "Done." message when a corpse is finished being looted but only if "Close Corpses" is off.
-Added support for sub-containers.
-Fixed a bug in the method I had used to read info on chests.
-Fixed the "That is out of sight" message being repeated over and over due to an item being not draggable. Hopefully this being caught now will prevent crashes.


Known Issues:
1. This is a heavy script. It may crash your UO if used with too many others at once or if you have a crappy system.
2. Sometimes the script may loot items that you don't desire it to. I'm still in the process of filtering the items, so if anything falls into your looting packs that you don't want or didn't select somewhere, please post it here for me to add to the filter.
3. There is some evidence now to indicate that if this script is crashing your UO client, you may have some incorrect registry entries. There is a post at the top of this forum to help you fix that (Cannot find suitable cliloc file). I realize this topic relates to razor, not easyUO, but these registry entries being discussed are those of UO, not of Razor. Razor reads these registry entries as does EasyUO, so fixing them would probably help :)

Enjoy!!

Code: Select all

;------------------------+
;Kaiana's Uber-Looter    |
;(for looting items)     |
;------------------------+

;NOTES TO SELF (Stuff to do)

;1 - make invcleanup do more, such as smelting ore on
;       mobile forge and putting in keys
;2 - Add deathwatch beetle seeds
;3 - search nearby ground
;4 - good drop assessment (way later)
;para chest item type IIF_HIF
;bones = GUF
;Cell Key - DFG
;torso pieces and irk's brain need filters

set %version 0.91c
set %build 10.11.10

event SysMessage Kaiana's UberLooter version %version build %build ...
;New in version 0.5 - Chest looting!
;New in version 0.6 - Minimalized LastObject interference, improved speed!
;New in version 0.65 - Setup menu and bag saving!
;New in version 0.7 - Item Setup and saving!
;New in version 0.8 - Mage quest looting!  More efficiency!
;New in version 0.85 - More options!
;New in version 0.87 - Save button on Options menu!
;New in version 0.88 - Added more items!
;New in version 0.88b - Interface changes...
;New in version 0.90 - Lockpicking, various fixes and tweaks
;New in version 0.91 - Lockpicking fixes, sub-container support
event SysMessage New in version %version - Lockpicking fixes, sub-container support

set %testX #SCNT2

;set IMPORTANT bag variables
set %waitTime 10
set %myHoldingBag *savedHoldingBag
set %myOtherBag *savedOtherBag
set %myJewelBag *savedJewelBag
set %mySpellKeys *savedSpellKeys
set %myMetalKeys *savedMetalKeys
set %myWoodKeys *savedWoodKeys
set %myTailorKeys *savedTailorKeys
set %myStoneKeys *savedStoneKeys

;set other IMPORTANT stuff
set %beenGhost #false
set %moveToCorpse #false
set %paused #false
set %picksSet #false
set %currPicksID X
set %currPicksType X
set %pauseTimer 0
set %lootTypeReturn 0
set %levelsDeep 0
set %tempIgnoring #false
set *isLooting #false

;set up support for key gumps
set %spellMenuSize 505_475
set %metalMenuSize 505_270
set %woodMenuSize 505_295
set %tailorMenuSize 505_440
set %stoneMenuSize 505_270
set %spellAddX 290
set %spellAddY 435
set %metalAddX 290
set %metalAddY 235
set %woodAddX 290
set %woodAddY 260
set %tailorAddX 290
set %tailorAddY 410
set %stoneAddX 290
set %stoneAddY 235

;=================ITEM LISTS

;============MISC
set %gold POF_ ;Gold
set %oints WLF_ ;Ointment, Essences
set %skulls PCK_QCK_ ;All Champ skulls, human skulls(dark father)
set %gargs ZRF_GMH_QPF_ ;Garg Items
set %recipes PIP_ ;Recipe Scrolls
set %ores DWJ_ENK_TLK_ZLK_ ;All Ore/Ingots/Boards/Logs
set %runictools TLH_KTL_UFG_ ;Runic Hammer, Runic Tinker, Runic Fletcher
set %jewels EVF_HVF_BVF_RVF_ZVF_GVF_NVF_UVF_FXS_GXS_ZWS_AXS_TWS_WWS_VWS_UWS_VVF_
set %seeds PDF_
set %arrows RWF_
set %arcanegems JSL_
set %filters UJG_ZRF_GMH_QPF_RMH_XMF_POL_IJG_GMF_FSF_EWH_MPF_PZF_XDI_SEG_REG_CFG_DCI_YWL_ZWF_RZF_LWL_

;============QUEST STACKS
;Zoogi Fungus, Daemon Bones
set %queststacks TTO_OZF_

;============TRANS-POWDER ITEMS
;Bracelet of Binding, Pet Summoning Ball
set %transpowderitems IJG_GMF_

;============IMPRISONED PETS
;Imprisoned Dog/Squirrel, Imprisoned Ferret
set %imppets XWL_BXL_

;============NON-NECRO REGS
;Normal Regs (Magery, Druid)
set %regs KUF_JUF_KZF_JZF_MZF_WZF_RZF_SZF_PLF_WLF_IND_

;============PEERLESS NON-STACKABLES
;Mark of Travesty, Map, Teakwood Tray (x2), Sushi Prep (x2),
;Travesty's Collection of Shells (x2), Crimson Cincture,
;Parrot Deed, Melisande's Corroded Hatchet, Bat Wings
;Dread's Revenge Medallion of the Undead,
;Crystalline Ring, Necromancer's Cloak
set %peerlessnonstacks PZH_SVH_ETD_BTD_TML_WML_HXF_TXF_XDI_EWH_FSF_NVI_WRH_SJG_UJG_DCI_

;============PEERLESS STACKABLES
;Eye of Travesty, Corruption, Putrefaction, Blight,
;Scourge, Taint, Muculent, Elven Notes
set %peerlessstacks LWS_EWS_GWS_JWS_DWS_FWS_QWS_XMF_

;============PEERLESS KEYS
;Serpent Fang Key, Dragon Flame Key, Tiger Claw Key,
;Door & Chest Key, Crypt Key are in first three
;...and then:
;Sabrix's Eye, Thorny Briar, Blighted Cotton, Lissith's Silk, Irk's
;Brain/Rabid Brain, Gnaw's Fang, Severed Right Leg,
;Severed Left Leg, Severed Left Arm, Rotting Head,
;Severed Right Arm, Blackened Heart, Dismembered Torso
;Scattered Crystal, Crystal Fragments, Shattered Crystal,
;Broken Crystal, Fractured Crystal, Piece of Crystal
set %peerlesskeys SEG_REG_CFG_LWL_WIS_FPE_RZF_YWK_MIG_MWK_KWK_GJL_WIL_VIL_LWK_FIL_CXM_OXM_HXM_XBN_UBN_EXM_

;============COLLECTOR ITEMS
;=====Prism of Light:
;Prism of Light, Ice Wyrm Spike, A Hydra Scale, Krystalen,
;Ring of Ice, Icy Heart, A Frozen Soul, Jar Of Glacial Water
set %mageitemsprism YWL_PWS_STO_RBN_UJG_DAG_FAV_JEG_
;=====Blighted Grove:
;Lady Melisande's Spellbook, Remnants of an Ancient Ent,
;Insanity Taffy, Abscess Tooth, Dream Catcher, Tangle Fluid,
;Thrasher's Scale
set %mageitemsblight MPF_LSE_FND_IEG_VLK_LHJ_STO_
;=====Bedlam:
;Grizzled Bones, Jade Amulet, Skeleton Key, Jonath's Mask,
;Adam's Rib
set %mageitemsbedlam  VNF_AXS_CFG_BCP_MJK_
;=====Sanctuary:
;Dead Mouse, Magic Stones, Smoldering Larynx, Cyclopean Axe,
;A Spanish Doubloon
set %mageitemssanc YRL_HNL_NWK_RMH_POF_
;=====Labyrinth:
;Horn of Defeat, A Pyre's Feathers, An Egiptski Relic,
;A Skorp Stinger, A Gold Nugget
set %mageitemslaby ZWF_QFF_SXF_PZF_KXF_
;=====Paroxysmus:
;Acid Proof Rope, Deadly Fang, Radioactive Material, Vile Venom,
;Smelly Goo
set %mageitemsparox MSL_QWI_WLF_HMF_UZG_


;============BOX TYPES - For Chest Looting
set %boxTypes KIF_ZTD_UMF_IIF_BKF_BUD_WMF_IKF_VMF_KKF_JKF_HIF_JIF_CUD_HKF_KER_CIR_ZHR_EIR_XHR_HIR_KIR_
set %bagTypes CKF_ZJF_LKF_UXM

;SETUP LOOT BAGS
set %lootNormal *savedLootNormal
set %lootHolding *savedLootHolding
set %lootJewels *savedLootJewels
set %lootAll *savedLootAll

;Setup targeting stuff
set %targetType X
set %targetKind X
set %targetID X
set %targetLocX X
set %targetLocY X
set %currKind X
set %contOpen #false

;Setup clicking stuff
set %openLocX #CLIXRES - 144
set %openLocY #CLIYRES - 212
set %boxLocX #CLIXRES - 180
set %boxLocY #CLIYRES - 240
set %closeLocX %openLocX + 30
set %closeLocY %openLocY + 30
set %closeBoxLocX %boxLocX + 30
set %closeBoxLocY %boxLocY + 30

;Setup savelast stuff
set %lastObjectID X
set %lastObjectType X
set %lastTargetID X
set %lastTargetKind X

;display load time
set %testX #SCNT2 - %testX
event SysMessage Loaded Items in %testX tenths of a second.
event SysMessage Hold Ctrl+Delete to pause.

gosub SetupBags
gosub SetupItems
display ok Script started successfully.$$To pause the script, hold CTRL+DEL.$To unpause again, hit DEL.$While paused, hit INSERT to access the setup again.
loop:
   onhotkey DELETE CTRL
      gosub PauseLoop
   gosub MainLoop
   onhotkey DELETE CTRL
      gosub PauseLoop
   gosub ChestLoop
   onhotkey DELETE CTRL
      gosub PauseLoop
   gosub CleanUpInv
goto loop

;=============SETUPBAGS ROUTINE - menu open
;Brings up menu
sub SetupBags
{
   ;Check if setup is already completed
   if *isDone = 1
      return

   displaymenu:
   menu Window Size 360 180
   menu Window Title UberLooter
   menu Image Create div1 0 0 360 180
   menu Font Size 9
   menu Text txtHolding 0 0 Stackables Bag ID: %myHoldingBag
   menu Text txtOther 0 16 Non-Stackables Bag ID: %myOtherBag
   menu Text txtJewelBag 0 32 Gem Pouch ID: %myJewelBag
   menu Image Line div1 198 0 198 79 black 1
   menu Image Line div1 0 47 198 47 black 1
   menu Image Line div1 0 79 360 79 black 1
   menu Text txtSpellKeys 200 0 Spell Keys ID: %mySpellKeys
   menu Text txtMetalKeys 200 16 Metal Keys ID: %myMetalKeys
   menu Text txtWoodKeys 200 32 Wood Keys ID: %myWoodKeys
   menu Text txtTailorKeys 200 48 Tailor Keys ID: %myTailorKeys
   menu Text txtStoneKeys 200 64 Stone Keys ID: %myStoneKeys
   menu Button btnSetup 0 48 100 16 Setup
   menu Text txtInfo 0 64 If bags/keys show N/A, click Setup.
   menu Check chkLootCorpses 0 80 200 16 #true Loot Corpses
   menu Check chkCloseCorpses 10 96 200 16 #true Close Corpses After Looting
   menu Check chkLootChests 0 112 200 16 #true Loot Chests
   menu Check chkLockpick 10 128 200 16 #true Use Lockpicks Instead of Magic
   menu Check chkCleanInv 0 144 200 16 #true Clean Up Inventory
   menu Check chkAutoKey 10 160 200 16 #true Auto-Add Items to Keys
   menu Check chkBattleLoot 200 80 160 16 #true Loot During Battle
   menu Button btnDone 260 140 100 20 Items...
   menu Button btnSave 260 160 100 20 Save
   if *optionCloseCorpses = 0
      menu set chkCloseCorpses 0
   if *optionCleanInv = 0
      menu set chkCleanInv 0
   if *optionLootCorpses = 0
      menu set chkLootCorpses 0
   if *optionLootChests = 0
      menu set chkLootChests 0
   if *optionLockpick = 0
      menu set chkLockpick 0
   if *optionAutoKey = 0
      menu set chkAutoKey 0
   if *optionBattleLoot = 0
      menu set chkBattleLoot 0
   menu HideEUO
   menu Show

   set #MENUBUTTON X
   repeat
   {
      sleep 1
   }
   until #MENUBUTTON <> X
   if #MENUBUTTON = Closed
      halt
   if #MENUBUTTON = btnSetup
   {
      menu Hide
      ;Get stackable bag
      display ok Please target your bag for stackables.  You may wish to use a holding bag for this category.
      event macro 8 7 ;open backpack
      set #TARGCURS 1
      set #LTARGETID X
      repeat
      {
         sleep 1
      }
      until #LTARGETID <> X
      set %myHoldingBag #LTARGETID
      ;Get non-stackable bag
      display ok Please target your bag for non-stackables.  A pouch or chest with a high item limit works best.
      set #TARGCURS 1
      set #LTARGETID X
      repeat
      {
         sleep 1
      }
      until #LTARGETID <> X
      set %myOtherBag #LTARGETID
      ;Get jewel bag
      display ok Please target your gem pouch. (Excelsior Exclusive!) $$If you do not have a gem pouch, it is recommended you use the same bag you used for stackables.
      set #TARGCURS 1
      set #LTARGETID X
      repeat
      {
         sleep 1
      }
      until #LTARGETID <> X
      set %myJewelBag #LTARGETID
      ;Get spell keys
      ;display okcancel Please target your spellcaster's keys.  (Cancel if you do not have them.)
      ;if #dispres <> cancel
      ;{
      ;   set #TARGCURS 1
      ;   set #LTARGETID X
      ;   repeat
      ;   {
      ;      sleep 1
      ;   }
      ;   until #LTARGETID <> X
      ;   set %mySpellKeys #LTARGETID
      ;}
      set %mySpellKeys N/A
      finditem NUI C_ , #BACKPACKID
      repeat
      {
         if #FINDKIND <> -1
         {
            event property #FINDID
            if Spell , #spc , Caster in #property && Keys in #property
               set %mySpellKeys #FINDID
            else
            {
               ignoreitem #FINDID 3
               finditem NUI C_ , #BACKPACKID
            }
         }
      }
      until %mySpellKeys <> N/A || #FINDKIND = -1
      ;keys found or all keys checked and none found
      ignoreitem reset 3
      if %mySpellKeys <> N/A
         display ok Spell Caster's Keys Found!
      else
         display ok No Spell Caster's Keys Detected.
      ;get metalworker's keys
      set %myMetalKeys N/A
      finditem NUI C_ , #BACKPACKID
      repeat
      {
         if #FINDKIND <> -1
         {
            event property #FINDID
            if Metal , #spc , Worker in #property && Keys in #property
               set %myMetalKeys #FINDID
            else
            {
               ignoreitem #FINDID 3
               finditem NUI C_ , #BACKPACKID
            }
         }
      }
      until %myMetalKeys <> N/A || #FINDKIND = -1
      ;keys found or all keys checked and none found
      ignoreitem reset 3
      if %myMetalKeys <> N/A
         display ok Metal Worker's Keys Found!
      else
         display ok No Metal Worker's Keys Detected.
      ;get woodworker's keys
      set %myWoodKeys N/A
      finditem NUI C_ , #BACKPACKID
      repeat
      {
         if #FINDKIND <> -1
         {
            event property #FINDID
            if Wood , #spc , Worker in #property && Keys in #property
               set %myWoodKeys #FINDID
            else
            {
               ignoreitem #FINDID 3
               finditem NUI C_ , #BACKPACKID
            }
         }
      }
      until %myWoodKeys <> N/A || #FINDKIND = -1
      ;keys found or all keys checked and none found
      ignoreitem reset 3
      if %myWoodKeys <> N/A
         display ok Wood Worker's Keys Found!
      else
         display ok No Wood Worker's Keys Detected.
      ;get tailor's keys
      set %myTailorKeys N/A
      finditem NUI C_ , #BACKPACKID
      repeat
      {
         if #FINDKIND <> -1
         {
            event property #FINDID
            if Tailor in #property && Keys in #property
               set %myTailorKeys #FINDID
            else
            {
               ignoreitem #FINDID 3
               finditem NUI C_ , #BACKPACKID
            }
         }
      }
      until %myTailorKeys <> N/A || #FINDKIND = -1
      ;keys found or all keys checked and none found
      ignoreitem reset 3
      if %myTailorKeys <> N/A
         display ok Tailor's Keys Found!
      else
         display ok No Tailor's Keys Detected.
      ;get stoneworker keys
      set %myStoneKeys N/A
      finditem NUI C_ , #BACKPACKID
      repeat
      {
         if #FINDKIND <> -1
         {
            event property #FINDID
            if Stone , #spc , Worker in #property && Keys in #property
               set %myStoneKeys #FINDID
            else
            {
               ignoreitem #FINDID 3
               finditem NUI C_ , #BACKPACKID
            }
         }
      }
      until %myStoneKeys <> N/A || #FINDKIND = -1
      ;keys found or all keys checked and none found
      ignoreitem reset 3
      if %myStoneKeys <> N/A
         display ok Stone Worker's Keys Found!
      else
         display ok No Stone Worker's Keys Detected.
      goto displaymenu
   }
   if #MENUBUTTON = btnDone || #MENUBUTTON = btnSave
   {
      menu Get chkCloseCorpses
      set *optionCloseCorpses #menures
      menu Get chkCleanInv
      set *optionCleanInv #menures
      menu Get chkLootCorpses
      set *optionLootCorpses #menures
      menu Get chkLootChests
      set *optionLootChests #menures
      menu Get chkLockpick
      set *optionLockpick #menures
      menu Get chkAutoKey
      set *optionAutoKey #menures
      menu Get chkBattleLoot
      set *optionBattleLoot #menures

      set *savedHoldingBag %myHoldingBag
      set *savedOtherBag %myOtherBag
      set *savedJewelBag %myJewelBag
      set *savedSpellKeys %mySpellKeys
      set *savedMetalKeys %myMetalKeys
      set *savedWoodKeys %myWoodKeys
      set *savedTailorKeys %myTailorKeys
      set *savedStoneKeys %myStoneKeys
      set *isDone 1

      if #MENUBUTTON = btnSave
         set *isDoneItems 1
      else
         set *isDoneItems 0

      menu Clear
      menu Hide
      return
   }
}

;=============SETUPITEMS ROUTINE - menu open
;Brings up item menu
sub SetupItems
{
   ;Check if setup is already completed
   if *isDoneItems = 1
      return

   ;Init Window------------------------------------------------------
   event SysMessage Loading Items...
   menu Window Size 340 480                                         ;
   menu Window Title UberLooter Items                               ;
                                                                    ;
   menu Check chkGold 0 0 180 20 #true Gold                         ;
   menu Combo Create cmbGold 220 0 120                              ;
   menu Combo Add cmbGold Stackables                                ;
   menu Combo Add cmbGold Non-Stackables                            ;
   menu Combo Select cmbGold 1                                      ;
                                                                    ;
   menu Check chkOints 0 20 180 20 #true Oints/Essences             ;
   menu Combo Create cmbOints 220 20 120                            ;
   menu Combo Add cmbOints Stackables                               ;
   menu Combo Add cmbOints Non-Stackables                           ;
   menu Combo Select cmbOints 1                                     ;
                                                                    ;
   menu Check chkSkulls 0 40 180 20 #true Champ Skulls              ;
   menu Combo Create cmbSkulls 220 40 120                           ;
   menu Combo Add cmbSkulls Stackables                              ;
   menu Combo Add cmbSkulls Non-Stackables                          ;
   menu Combo Select cmbSkulls 2                                    ;
                                                                    ;
   menu Check chkGargs 0 60 180 20 #true Garg Items                 ;
   menu Combo Create cmbGargs 220 60 120                            ;
   menu Combo Add cmbGargs Stackables                               ;
   menu Combo Add cmbGargs Non-Stackables                           ;
   menu Combo Select cmbGargs 2                                     ;
                                                                    ;
   menu Check chkPeerlessKeys 0 80 180 20 #true Peerless Keys/Summoners
   menu Combo Create cmbPeerlessKeys 220 80 120                     ;
   menu Combo Add cmbPeerlessKeys Stackables                        ;
   menu Combo Add cmbPeerlessKeys Non-Stackables                    ;
   menu Combo Select cmbPeerlessKeys 2                              ;
                                                                    ;
   menu Check chkRecipes 0 100 180 20 #true Recipes                 ;
   menu Combo Create cmbRecipes 220 100 120                         ;
   menu Combo Add cmbRecipes Stackables                             ;
   menu Combo Add cmbRecipes Non-Stackables                         ;
   menu Combo Select cmbRecipes 2                                   ;
                                                                    ;
   menu Check chkOres 0 120 180 20 #true Ore/Wood                   ;
   menu Combo Create cmbOres 220 120 120                            ;
   menu Combo Add cmbOres Stackables                                ;
   menu Combo Add cmbOres Non-Stackables                            ;
   menu Combo Select cmbOres 1                                      ;
                                                                    ;
   menu Check chkRunics 0 140 180 20 #true Runic Tools              ;
   menu Combo Create cmbRunics 220 140 120                          ;
   menu Combo Add cmbRunics Stackables                              ;
   menu Combo Add cmbRunics Non-Stackables                          ;
   menu Combo Select cmbRunics 2                                    ;
                                                                    ;
   menu Check chkJewels 0 160 180 20 #true Jewels                   ;
   menu Combo Create cmbJewels 220 160 120                          ;
   menu Combo Add cmbJewels Stackables                              ;
   menu Combo Add cmbJewels Non-Stackables                          ;
   menu Combo Add cmbJewels Gem Pouch                               ;
   menu Combo Select cmbJewels 3                                    ;
                                                                    ;
   menu Check chkQuestStacks 0 180 180 20 #true Quest Stackables    ;
   menu Combo Create cmbQuestStacks 220 180 120                     ;
   menu Combo Add cmbQuestStacks Stackables                         ;
   menu Combo Add cmbQuestStacks Non-Stackables                     ;
   menu Combo Select cmbQuestStacks 1                               ;
                                                                    ;
   menu Check chkTransPowderItems 0 200 180 20 #true Trans-Powder Items
   menu Combo Create cmbTransPowderItems 220 200 120                ;
   menu Combo Add cmbTransPowderItems Stackables                    ;
   menu Combo Add cmbTransPowderItems Non-Stackables                ;
   menu Combo Select cmbTransPowderItems 2                          ;
                                                                    ;                                                                ;
   menu Check chkRegs 0 220 180 20 #true Regs (Non-Necro)           ;
   menu Combo Create cmbRegs 220 220 120                            ;
   menu Combo Add cmbRegs Stackables                                ;
   menu Combo Add cmbRegs Non-Stackables                            ;
   menu Combo Select cmbRegs 1                                      ;
                                                                    ;
   menu Check chkPeerlessNonstacks 0 240 180 20 #true Peerless Non-Stackables
   menu Combo Create cmbPeerlessNonstacks 220 240 120               ;
   menu Combo Add cmbPeerlessNonstacks Stackables                   ;
   menu Combo Add cmbPeerlessNonstacks Non-Stackables               ;
   menu Combo Select cmbPeerlessNonstacks 2                         ;
                                                                    ;
   menu Check chkPeerlessStacks 0 260 180 20 #true Peerless Stackables
   menu Combo Create cmbPeerlessStacks 220 260 120                  ;
   menu Combo Add cmbPeerlessStacks Stackables                      ;
   menu Combo Add cmbPeerlessStacks Non-Stackables                  ;
   menu Combo Select cmbPeerlessStacks 1                            ;
                                                                    ;
   menu Check chkMagePrism 0 280 180 20 #true Prism of Light Items  ;
   menu Combo Create cmbMagePrism 220 280 120                       ;
   menu Combo Add cmbMagePrism Stackables                           ;
   menu Combo Add cmbMagePrism Non-Stackables                       ;
   menu Combo Select cmbMagePrism 2                                 ;
                                                                    ;
   menu Check chkMageBlight 0 300 180 20 #true Blighted Grove Items ;
   menu Combo Create cmbMageBlight 220 300 120                      ;
   menu Combo Add cmbMageBlight Stackables                          ;
   menu Combo Add cmbMageBlight Non-Stackables                      ;
   menu Combo Select cmbMageBlight 2                                ;
                                                                    ;
   menu Check chkMageBedlam 0 320 180 20 #true Bedlam Items         ;
   menu Combo Create cmbMageBedlam 220 320 120                      ;
   menu Combo Add cmbMageBedlam Stackables                          ;
   menu Combo Add cmbMageBedlam Non-Stackables                      ;
   menu Combo Select cmbMageBedlam 2                                ;
                                                                    ;
   menu Check chkMageSanc 0 340 180 20 #true Sanctuary Items        ;
   menu Combo Create cmbMageSanc 220 340 120                        ;
   menu Combo Add cmbMageSanc Stackables                            ;
   menu Combo Add cmbMageSanc Non-Stackables                        ;
   menu Combo Select cmbMageSanc 2                                  ;
                                                                    ;
   menu Check chkMageLaby 0 360 180 20 #true Labyrinth Items        ;
   menu Combo Create cmbMageLaby 220 360 120                        ;
   menu Combo Add cmbMageLaby Stackables                            ;
   menu Combo Add cmbMageLaby Non-Stackables                        ;
   menu Combo Select cmbMageLaby 2                                  ;
                                                                    ;
   menu Check chkMageParox 0 380 180 20 #true Paroxysmus Items      ;
   menu Combo Create cmbMageParox 220 380 120                       ;
   menu Combo Add cmbMageParox Stackables                           ;
   menu Combo Add cmbMageParox Non-Stackables                       ;
   menu Combo Select cmbMageParox 2                                 ;

   menu Check chkSeeds 0 400 180 20 #true Seeds      ;
   menu Combo Create cmbSeeds 220 400 120                       ;
   menu Combo Add cmbSeeds Stackables                           ;
   menu Combo Add cmbSeeds Non-Stackables                       ;
   menu Combo Select cmbSeeds 2

   menu Check chkArcaneGems 0 420 180 20 #true Arcane Gems      ;
   menu Combo Create cmbArcaneGems 220 420 120                       ;
   menu Combo Add cmbArcaneGems Stackables                           ;
   menu Combo Add cmbArcaneGems Non-Stackables                       ;
   menu Combo Select cmbArcaneGems 2                                 ;

   menu Check chkArrows 0 440 180 20 #true Arrows      ;
   menu Combo Create cmbArrows 220 440 120                       ;
   menu Combo Add cmbArrows Stackables                           ;
   menu Combo Add cmbArrows Non-Stackables                       ;
   menu Combo Select cmbArrows 1                                 ;
                                      ;                                                                 ;
   ;Now, get old settings if they exist                             ;
   gosub SetState chkGold cmbGold *lootingGold                      ;
   gosub SetState chkOints cmbOints *lootingOints                   ;
   gosub SetState chkSkulls cmbSkulls *lootingSkulls                ;
   gosub SetState chkGargs cmbGargs *lootingGargs                   ;
   gosub SetState chkPeerlessKeys cmbPeerlessKeys *lootingPeerlessKeys  ;
   gosub SetState chkRecipes cmbRecipes *lootingRecipes             ;
   gosub SetState chkOres cmbOres *lootingOres                      ;
   gosub SetState chkRunics cmbRunics *lootingRunics                ;
   gosub SetState chkJewels cmbJewels *lootingJewels                ;
   gosub SetState chkQuestStacks cmbQuestStacks *lootingQuestStacks ;
   gosub SetState chkTransPowderItems cmbTransPowderItems *lootingTransPowderItems
   gosub SetState chkRegs cmbRegs *lootingRegs                      ;
   gosub SetState chkPeerlessNonstacks cmbPeerlessNonstacks *lootingPeerlessNonstacks
   gosub SetState chkPeerlessStacks cmbPeerlessStacks *lootingPeerlessStacks    ;
   gosub SetState chkMagePrism cmbMagePrism *lootingMagePrism       ;
   gosub SetState chkMageBlight cmbMageBlight *lootingMageBlight    ;
   gosub SetState chkMageBedlam cmbMageBedlam *lootingMageBedlam    ;
   gosub SetState chkMageSanc cmbMageSanc *lootingMageSanc          ;
   gosub SetState chkMageLaby cmbMageLaby *lootingMageLaby          ;
   gosub SetState chkMageParox cmbMageParox *lootingMageParox       ;
   gosub SetState chkSeeds cmbSeeds *lootingSeeds       ;
   gosub SetState chkArcaneGems cmbArcaneGems *lootingArcaneGems       ;
   gosub SetState chkArrows cmbArrows *lootingArrows       ;
                                                                    ;
   menu Button btnDone 220 460 100 20 Done                          ;
   menu HideEUO                                                     ;
   menu Show                                                        ;
   ;----------------------------------------------End Window Init---;
   set #MENUBUTTON X
   repeat
   {
      sleep 1
   }
   until #MENUBUTTON <> X
   if #MENUBUTTON = Closed
      halt
   if #MENUBUTTON = btnDone
   {
      set %lootNormal
      set %lootHolding
      set %lootJewels
      set %lootAll

      ;Champ Skulls
      gosub GetState chkSkulls cmbSkulls %skulls
      set *lootingSkulls #result

      ;Imprisoned Pets
      ;gosub GetState chkImpPets cmbImpPets %imppets
      ;set *lootingImpPets #result

      ;Travesty Non-Stackables
      gosub GetState chkPeerlessNonstacks cmbPeerlessNonstacks %peerlessnonstacks
      set *lootingPeerlessNonstacks #result

      ;Travesty Stackables
      gosub GetState chkPeerlessStacks cmbPeerlessStacks %peerlessstacks
      set *lootingPeerlessStacks #result

      ;Travesty Keys
      gosub GetState chkPeerlessKeys cmbPeerlessKeys %peerlesskeys
      set *lootingPeerlessKeys #result

      ;Garg Items
      gosub GetState chkGargs cmbGargs %gargs
      set *lootingGargs #result

      ;Quest Stackables
      gosub GetState chkQuestStacks cmbQuestStacks %queststacks
      set *lootingQuestStacks #result

      ;Trans Powder Items
      gosub GetState chkTransPowderItems cmbTransPowderItems %transpowderitems
      set *lootingTransPowderItems #result

      ;Oints/Essences
      gosub GetState chkOints cmbOints %oints
      set *lootingOints #result
      ;Runic Tools
      gosub GetState chkRunics cmbRunics %runictools
      set *lootingRunics #result

      ;Recipes
      gosub GetState chkRecipes cmbRecipes %recipes
      set *lootingRecipes #result

      ;Ore
      gosub GetState chkOres cmbOres %ores
      set *lootingOres #result

      ;Jewels
      gosub GetState chkJewels cmbJewels %jewels
      set *lootingJewels #result

      ;Regs
      gosub GetState chkRegs cmbRegs %regs
      set *lootingRegs #result

      ;Gold
      gosub GetState chkGold cmbGold %gold
      set *lootingGold #result

      gosub GetState chkMagePrism cmbMagePrism %mageitemsprism
      set *lootingMagePrism #result

      gosub GetState chkMageBlight cmbMageBlight %mageitemsblight
      set *lootingMageBlight #result

      gosub GetState chkMageBedlam cmbMageBedlam %mageitemsbedlam
      set *lootingMageBedlam #result

      gosub GetState chkMageSanc cmbMageSanc %mageitemssanc
      set *lootingMageSanc #result

      gosub GetState chkMageLaby cmbMageLaby %mageitemslaby
      set *lootingMageLaby #result

      gosub GetState chkMageParox cmbMageParox %mageitemsparox
      set *lootingMageParox #result

      gosub GetState chkSeeds cmbSeeds %seeds
      set *lootingSeeds #result

      gosub GetState chkArcaneGems cmbArcaneGems %arcanegems
      set *lootingArcaneGems #result

      gosub GetState chkArrows cmbArrows %arrows
      set *lootingArrows #result

      set %lootAll %lootNormal , %lootHolding , %lootJewels
      set *savedLootNormal %lootNormal
      set *savedLootHolding %lootHolding
      set *savedLootJewels %lootJewels
      set *savedLootAll %lootAll
      set *isDoneItems 1

      menu Clear
      menu Hide
      return
   }
}

;=============SETSTATE FUNCTION - Checks options
;Checks the options in the item menu and builds lists
sub SetState ;%1 = checkboxname, %2 = comboboxname, %3 = saved state
{
   if %3 = 0
   {
      menu Set %1 0
      menu Set %2 1
   }
   if %3 = 1 || %3 = 2 || %3 = 3
   {
      menu Set %1 -1
      menu Combo Select %2 %3
   }
   if %3 <> 0 && %3 <> 1 && %3 <> 2 && %3 <> 3
   {
      menu Set %1 -1
   }
   return
}

;=============GETSTATE FUNCTION - Checks options
;Checks the options in the item menu and builds lists
sub GetState ;%1 = checkboxname, %2 = comboboxname, %3 = items to add
{
   menu Get %1
      if #menures <> 0
      {
         menu Get %2
         if #menures = 1
         {
            set %lootHolding %lootHolding , %3
         }
         if #menures = 2
         {
            set %lootNormal %lootNormal , %3
         }
         if #menures = 3
         {
            set %lootJewels %lootJewels , %3
         }
         return #menures
      }
      else
         return 0
}

;=============PAUSELOOP ROUTINE - Pauses the lootz
;Activates Pause mode
sub PauseLoop
{
    set %paused #true
    set %pauseTimer #SCNT
    event SysMessage Looting PAUSED...hit Delete to resume, Insert for menu.
    repeat
    {
       if %pauseTimer < #SCNT - 20
       {
          set %pauseTimer #SCNT
          event SysMessage Looting PAUSED...hit Delete to resume.
       }
       onhotkey DELETE
          set %paused #false
       onhotkey INSERT
       {
          set *isDone 0
          gosub SetupBags
          gosub SetupItems
          display Ok Settings changed successfully.
       }
    }
    until %paused = #false
    event SysMessage Looting UNPAUSED...
    return
}

;=============MAINLOOP ROUTINE - Runs the looting
;Loots desired items to desired bags.
sub MainLoop
{
   if *optionLootCorpses = 0
      return

   ;Check status
   gosub GetStatus
   if #RESULT = #FALSE
      return

   ;If character has been a ghost, prioritize finding the character corpse first
   if %beenGhost = #true
   {
      finditem YFM G_2
      if #FINDKIND = -1 || #FINDDIST > 2
         return ;No Corpse Found In Range
      ;Else, Corpse Found

      ;Check if corpse is character's
      event Property #FINDID
      if #CHARNAME notin #PROPERTY
      {
         ;Not the character corpse
         ignoreitem #FINDID 2
         return
      }

      ;Corpse belongs to character
      set %targetType #FINDTYPE
      set %targetID #FINDID

      ;Open corpse
      gosub SaveLast
      gosub SetTarget
      event Macro 17
      gosub LoadLast
      wait %waitTime

      ;Restore normal state
      set %beenGhost #false
      event SysMessage Character corpse found, returning to normal...
      ignoreitem reset 2
      return
   }
   retryOpen:
   finditem YFM G_2
   if #FINDKIND = -1 || #FINDDIST > 2
      return ;No corpse found
   ;Else, corpse found
   event ExMsg #FINDID 2 13 Looting...

   ;Acquire target
   set %targetType #FINDTYPE
   set %targetID #FINDID
   set %targetLocX #FINDX
   set %targetLocY #FINDY

   ;Open Corpse if not already open
   gosub OpenTarget

   scanJournal 1
   ;Check if it wasn't opened
   if I_can't_reach_that in #journal || too_far_away in #journal
      return

   ;Check if it wasn't yours
   if did_not_earn_the_right in #journal
   {
      ignoreItem %targetID 1
      return
   }
   if #CONTID <> %targetID
      return

   ;Corpse Opened
   set %contOpen #true
   gosub LootItems
   
   ;Close Corpse
   if *optionCloseCorpses = 0
      set %contOpen #false

   ;Corpse was closed, may not have been looted fully
   if #CONTID <> %targetID
      return

   if %contOpen = #true && #result = #true
   {
      ;click %closeLocX %closeLocY DMC
      set #CONTID %targetID
      if #CONTID = %targetID
      {
         contPos %openLocX %openLocY
         click %closeLocX %closeLocY R DMC
         set %contOpen #false
      }
      else
         set %contOpen #false
   }

   ;If corpse was not completely looted, don't ignore
   if #result = #false then
      return
   ignoreItem %targetID 1
   return
}
;=============CHESTLOOP ROUTINE - Loots locked chests
;Will loot all desired items from locked chests in
;dungeons as MainLoop routine does
sub ChestLoop
{
   if *optionLootChests = 0
      return

   ;Check status
   gosub GetStatus
   if #RESULT = #FALSE
      return

   ;If character has been a ghost, prioritize finding
   ;the character corpse first
   if %beenGhost = #true
      return

   ;Search for treasure box
   checkForBox:
   nextcpos %boxLocX %boxLocY
   if *optionLockpick = -1
      findItem %boxTypes G_1
   else
      findItem %boxTypes G_2
   if #FINDKIND = -1 || #FINDDIST > 2
   {
      ;No Box Found In Range
      wait %waitTime
      return
   }  ;Else, Box Found

   ;Acquire Target
   set %targetID #FINDID
   set %targetLocX #FINDX
   set %targetLocY #FINDY
   set %targetKind #FINDKIND
   set %targetType #FINDTYPE

   ;Check if it's empty
   gosub SaveLast
   gosub SetTarget
   event Property #LTARGETID
   gosub LoadLast
   if $0 , #spc , Items in #PROPERTY || Locked , #spc , Down , #spc , & , #spc , Secure in #PROPERTY
   {
      ignoreItem %targetID 1
      wait %waitTime
      return
   }

   event ExMsg #FINDID 2 13 Looting...

   ;No "Stones" in description, meaning it's locked/trapped
   if Stones notin #PROPERTY
   {
      if *optionLockpick = -1
         gosub OpenChestLockpick
      else
         gosub OpenChestMagic
      if #result = #false
         return
      ;if #result = unable
      set #LSPELL 14
      event Macro 16
      target 60
      event Macro 22
      gosub LoadLast
      wait %waitTime
   }

   gosub OpenTarget
   
   ;Too far away
   if I_can't_reach_that in #journal || too_far_away in #journal
   {
      return
   }

   ;Opened chest, begin loot
   set %contOpen #TRUE
   gosub LootItems

   ;Close chest gump
   if *optionCloseCorpses = 0
      set %contOpen #false

   ;Chest was closed, may not have been completely looted
   if #CONTID <> %targetID
      return

   if %contOpen = #true && #result = #true
   {
      set #CONTID %targetID
      if #CONTID = %targetID
      {
         contPos %boxLocX %boxLocY
         click %closeBoxLocX %closeBoxLocY R DMC
         set %contOpen #false
      }
      else
         set %contOpen #false
   }

   ;If chest was not completely looted, do not ignore
   if #result = #false then
      return
   ignoreItem %targetID 1
   return
}

;=============CLEANUPINV ROUTINE - Checks Inv for items
;Useful for mining, lumberjacking
sub CleanUpInv
{
   if *optionCleanInv = 0
      return
   ;Check status
   gosub GetStatus
   if #RESULT = #FALSE
      return
   ;Acquire target
   set %targetType ZJF
   set %targetID #BACKPACKID
   set %targetLocX #CHARPOSX
   set %targetLocY #CHARPOSY

   ;if *optionAutoKey = 1
   ;{
   ;   gosub AutoKeyItems
   ;}

   gosub LootItems
   set %tempRes #result

   return
}

;=============LOOTITEMS FUNCTION - Grabs stuffz
;Checks for normal, then holding, then jewels.
;
;Also returns a boolean value to indicate whether
;the corpse is fully looted or not, so the script
;won't ignore the corpse.
sub LootItems
{
   checkForLoot:
   gosub GetStatus
   if #RESULT = #FALSE
   {
      wait %waitTime
      return #false ;corpse not looted
   }
   if %targetType = YFM
   {
      set *isLooting #true
   }
   if %targetID = #BACKPACKID
      finditem %lootAll C_ , %targetID
   else
      findItem %lootAll , %boxTypes , %bagTypes C_ , %targetID
   if #FINDKIND = -1
   {
      set *isLooting #false
      if %targetID <> #BACKPACKID && *optionCloseCorpses = 0
         event ExMsg %targetID 2 12 Done.
      return #true ;all items searched, nothing found
   }
   ;loot found
   if #FINDTYPE in %boxTypes , %bagTypes
   {
      ;sub-container found, loot it
      ;Acquire Target
      gosub SubBagUp
      ;Open container if not already open
      gosub OpenTarget
      scanJournal 1
      ;Check if it wasn't opened
      if I_can't_reach_that in #journal || too_far_away in #journal || #CONTID <> %targetID
      {
         gosub SubBagDown
         goto checkForLoot
      }
      ;Cont Opened
      gosub LootItems
      if #result = #true
      {
         ignoreitem %targetID 1
         gosub SubBagDown
         goto checkForLoot
      }
   }
   ;loot is not sub-container
   gosub SmartFilter
   if #RESULT = 0
   {
      ignoreitem #FINDID 1
      goto checkForLoot
   }
   set %lootTypeReturn #RESULT
   gosub CheckDist 2
   if #RESULT = #FALSE
   {
      event ExMsg %targetID 2 13 Too far...
      wait %waitTime
      return #false ;corpse not completely looted
   }

   ;Identify Items
   event Property #FINDID
   str pos #PROPERTY $
   set %endPos #STRRES - 1
   str left #PROPERTY %endPos
   set %foundString #STRRES
   event SysMessage %foundString obtained.
   
   ;Make sure when it is dragged it is not out of sight
   exevent Drag #FINDID #FINDSTACK
   ;wait %waitTime
   if %lootTypeReturn = 1
      exevent Dropc %myHoldingBag
   if %lootTypeReturn = 2
      exevent Dropc %myOtherBag
   if %lootTypeReturn = 3
   {
      if #FINDTYPE in %lootHolding
         exevent Dropc %myHoldingBag
      if #FINDTYPE in %lootNormal
         exevent Dropc %myOtherBag
      if #FINDTYPE in %lootJewels
         exevent Dropc %myJewelBag
   }
   wait %waitTime
   set %jrnl #jindex
   scanjournal %jrnl
   if That_is_out_of_sight in #journal
   {
         ignoreitem %targetID 3
         set %tempIgnoreTime #SCNT
         set %tempIgnoring #true
         event ExMsg %targetID 2 30 (Ten Second Ignore)
         return #false ;corpse not completely looted
   }
   goto checkForLoot
}

;=============CHECKDIST FUNCTION - Checks distance
;Makes sure corpse is in range (for tracking movement)
sub CheckDist ;%1 = distance to check
{
   if #CHARPOSX > %targetLocX + %1 || #CHARPOSX < %targetLocX - %1 || #CHARPOSY > %targetLocY + %1 || #CHARPOSY < %targetLocY - %1
      return #FALSE   ;out of range
   else
      return #TRUE
}

;=============SAVELAST FUNCTION - Saves last item
;Saves the current Last Object before changing it to
;perform some function in the script, to retrieve
;afterwards with LoadLast
sub SaveLast
{
   set %lastObjectID #LOBJECTID
   set %lastOjectType #LOBJECTTYPE
   set %lastTargetID #LTARGETID
   set %lastTargetKind #LTARGETKIND
   return
}

;=============LOADLAST FUNCTION - Loads last item
;Restores the Last Object to pre-function state
sub LoadLast
{
   set #LOBJECTID %lastObjectID
   set #LOBJECTTYPE %lastOjectType
   set #LTARGETID %lastTargetID
   set #LTARGETKIND %lastTargetKind
   return
}

;=============SETTARGET FUNCTION - Set target
;Sets last object values to target values
sub SetTarget
{
   set #LOBJECTID %targetID
   set #LOBJECTTYPE %targetType
   set #LTARGETID %targetID
   set #LTARGETKIND %targetKind
   return
}

;=============GETSTATUS FUNCTION - Confirms action ready
;Makes sure the character is not lifting something,
;setting a number in a stack, targeting, not logged in,
;a ghost, or hidden.
;If the character dies, the script looks for the corpse,
;but not until the character is alive, of course.
sub GetStatus
{
   if %tempIgnoring = #true && #SCNT - %tempIgnoreTime > 10
   {
      ignoreitem reset 3
      set %tempIgnoring #false
      event SysMessage Clearing 10 second ignores...
   }
   onhotkey DELETE CTRL
      return #FALSE
   IF #LLIFTEDKIND = 1 || #CONTNAME = drag_gump || #CONTNAME = stack_gump || #TARGCURS = 1 || #CLILOGGED = 0 || #CHARGHOST = YES || H IN #CHARSTATUS || #ENEMYID <> N/A
   {
      if #CHARGHOST = YES && %beenGhost = #false
      {
         event SysMessage Character death detected, searching for corpse...
         set %beenGhost #true
      }

      ;Allow corpse to be looted while hidden
      if #CHARGHOST = NO && %beenGhost = #true && H in #CHARSTATUS
         return #TRUE

      ;If battle looting option is on, don't wait
      if #ENEMYID <> N/A && *optionBattleLoot = -1
         return #TRUE

      return #FALSE
   }
   return #TRUE
}

;=============SMARTFILTER FUNCTION - Filters like items
;Checks to make sure the found item is actually the item we want
;and not just some item with the same itemtype.
;Returns 0 if its just some crap
;Returns 1 if its an item we want in holding bag
;Returns 2 if its an item we want in normal bag
;Returns 3 if its a non-filtered item we want
sub SmartFilter
{
   if #FINDTYPE in %filters
   {
      event Property #FINDID
      if #FINDTYPE in POL_ ;Gold/Spanish Doubloon
      {
         if Spanish , #spc , Doubloon notin #PROPERTY
            return *lootingGold
         return *lootingMageSanc
      }
      if #FINDTYPE in WLF_ ;Oints/Essences/Radioactive Material
      {
         if Ointment notin #PROPERTY && Essence , #spc , Of notin #PROPERTY && Radioactive , #spc , Material notin #PROPERTY
            return 0
         if Ointment in #PROPERTY || Essence , #spc , Of in #PROPERTY
            return *lootingOints
         return *lootingMageParox
      }
      if #FINDTYPE in RZF_ ;Spider's Silk/Lissith's Silk
      {
         if Lissith notin #PROPERTY
            return *lootingRegs
         return *lootingKeys

      }
      if #FINDTYPE in ZRF_GMH_QPF_ ;gargs
      {
         if Gargoyles notin #PROPERTY && Gargoyle's notin #PROPERTY
            return 0
         return *lootingGargs
      }
      if #FINDTYPE in IJG_GMF_ ;trans powder items
      {
         if Bracelet , #spc , of , #spc , Binding notin #PROPERTY && Crystal , #spc , Ball , #spc , of , #spc , Pet , #spc , Summoning notin #PROPERTY
            return 0 ;only a regular crappy ball
         if [Linked , #spc , Pet:  , #spc , #spc notin #PROPERTY && Crystal , #spc , Ball , #spc , of , #spc , Pet , #spc , Summoning in #PROPERTY
            return 0 ;already linked to a pet, don't loot/move
         str len #PROPERTY
         if #STRRES > 28 && Bracelet , #spc , of , #spc , Binding in #PROPERTY
            return 0 ;already linked to a person, don't loot/move
         return *lootingTransPowderItems
      }
      if #FINDTYPE in XMF_ ;elven notes
      {
         if Elven , #spc , Note notin #PROPERTY
            return 0
         return *lootingPeerlessStacks
      }
      if #FINDTYPE in LWL_ ;sabrix's eye
      {
         if Sabrix notin #PROPERTY
            return 0
         return *lootingPeerlessKeys
      }
      if #FINDTYPE in UJG_ ;Crystalline Ring, Ring of Ice
      {
         if Crystalline , #spc , Ring notin #PROPERTY && Ring , #spc , of , #spc , Ice notin #PROPERTY
            return 0
         if Crystalline , #spc , Ring in #PROPERTY
            return *lootingPeerlessNonstacks
         return *lootingMagePrism
      }
      if #FINDTYPE in RMH_ ;Cyclopian Axe
      {
         if Cyclopian , #spc , Axe notin #PROPERTY
            return 0
         return *lootingMageSanc
      }
      if #FINDTYPE in FSF_ ;Melisande's Corroded Hatchet
      {
         if Melisande's , #spc , Corroded , #spc , Hatchet notin #PROPERTY
            return 0
         return *lootingPeerlessNonstacks
      }
      if #FINDTYPE in EWH_ ;A Deed For A Parrot
      {
         if A , #spc , Deed , #spc , F , or , #spc , A , #spc , Parrot notin #PROPERTY
            return 0
         return *lootingPeerlessNonstacks
      }
      if #FINDTYPE in MPF_ ;Lady Melisande's Spellbook
      {
         if Lady , #spc , Melisande's , #spc , Spellbook notin #PROPERTY
            return 0
         return *lootingMageBlight
      }
      if #FINDTYPE in PZF_ ;A Skorp Stinger
      {
         if A , #spc , Skorp , #spc , Stinger notin #PROPERTY
            return 0
         return *lootingMageLaby
      }
      if #FINDTYPE in XDI_ ;Crimson Cincture
      {
         if Crimson , #spc , Cincture notin #PROPERTY
            return 0
         return *lootingPeerlessNonstacks
      }
      if #FINDTYPE in SEG_REG_CFG_  ;Serpent Fang Key, Dragon Flame Key, Tiger Claw Key, Crypt Key
      {
         if Serpent , #spc , Fang notin #PROPERTY
         + && Dragon , #spc , Flame notin #PROPERTY
         + && Tiger , #spc , Claw notin #PROPERTY
         + && Door , #spc , & , #spc , Chest notin #PROPERTY
         + && Crypt notin #PROPERTY
            return 0
         return *lootingPeerlessKeys
      }
      if #FINDTYPE in DCI_ ;Necromancer's Cloak
      {
         if Necromancer's , #spc , Cloak notin #PROPERTY
            return 0
         return *lootingPeerlessNonstacks
      }
      if #FINDTYPE in YWL_ ;Prism of Light
      {
         if Prism , #spc , of , #spc , Light notin #PROPERTY
            return 0
         return *lootingMagePrism
      }
      if #FINDTYPE in ZWF_ ;Horn of Defeat
      {
         if Horn , #spc , of , #spc , Defeat notin #PROPERTY
            return 0
         return *lootingMageLaby
      }
   }
   return 3
}

sub WaitForGump ;%1 = contsize to wait for, %2 = waittime(seconds)
{
   set %gumpWaiting #SCNT
   repeat
   {
      sleep 1
   }
   until #CONTSIZE = %1 || #SCNT - %gumpWaiting > %2
   if #CONTSIZE = %1
      return #true ;gump has appeared
   else
      return #false ;hasn't shown up in allotted time
}

sub OpenChestLockpick
{
   gosub SaveLast

   ;get picks
   if %picksSet = #false
   {
      finditem IWH C_ , #BACKPACKID
      if #FINDKIND = -1
      {
         finditem IWH C_ , %myHoldingBag
         if #FINDKIND = -1
         {
            finditem IWH C_ , %myOtherBag
            if #FINDKIND = -1
            {
               event SysMessage No lockpicks found in your main packs.  Switching to magic opening mode...
               set *optionLockpick #false
               return #false
            }
         }
      }
      set %currPicksID #FINDID
      set %currPicksType #FINDTYPE
      event Property #FINDID
      str pos #PROPERTY #spc
      set %endPos #strres - 1
      str left #PROPERTY %endPos
      set %picksLeft #strres
      set %picksSet #true
   }

   ;picks acquired, use on chest
   repeatpick:
   set #LOBJECTID %currPicksID
   set #LOBJECTTYPE %currPicksType
   gosub CheckDist 1
   if #result = #false
   {
      event ExMsg %targetID 2 13 Too far...
      return #false
   }
   event Macro 17
   target 60
   gosub SetTarget
   event Macro 22
   set %jrnl #jindex
   scanjournal %jrnl
   click %clickLocX %clickLocY DMC
   repeat
   {
      if #jindex > %jrnl
      {
         set %jrnl %jrnl + 1
         scanjournal %jrnl
      }
      else
         sleep 1
   }
   until lock_quickly_yields_to_your_skill in #journal || does_not_appear_to_be_locked in #journal || too_far_away in #journal || see_how_that_lock_can_be_manipulated in #journal || unable_to_pick_the_lock in #journal

   if does_not_appear_to_be_locked in #journal
      return #true
      
   if too_far_away in #journal
   {
      event ExMsg %targetID 2 13 Too far...
      return #false
   }
   
   if lock_quickly_yields_to_your_skill in #journal || unable_to_pick_the_lock in #journal
   {
      set %picksLeft %picksLeft - 1
      if %picksLeft = 0
      {
         event SysMessage You have depleted your picks.
         set %picksSet #false
         set %currPicksID X
         set %currPicksType X
      }
      if unable_to_pick_the_lock in #journal
         goto repeatpick
      return #true
   }
   if see_how_that_lock_can_be_manipulated in #journal
      return unable
}

sub OpenChestMagic
{
   ;My spell does not seem to have an effect on that lock.
   gosub SaveLast
   gosub SetTarget
   set #LSPELL 23
   event Macro 16
   target 60
   event Macro 22
   wait %waitTime
   return #true
}

;\/CURRENTLY INCOMPLETE\/
sub AutoKeyItems
{
   checkForKeyItems:
   gosub GetStatus
   if #RESULT = #FALSE
   {
      wait %waitTime
      return #false ;corpse not looted
   }
   ;findItem %lootAll C_ , %targetID
   ;if #FINDKIND = -1
   ;   return #true ;all items searched, nothing found
   ;loot found
   ;gosub SmartFilter
   ;if #RESULT = 0
   ;{
   ;   ignoreitem #FINDID 1
   ;   goto checkForLoot
   ;}
   ;set %lootTypeReturn #RESULT
   ;gosub CheckDist 2
   ;if #RESULT = #FALSE
   ;{
   ;   event ExMsg %targetID 2 13 Too far...
   ;   wait %waitTime
   ;   return #false ;corpse not completely looted
   ;}

   ;Identify Items
   ;event Property #FINDID
   ;str pos #PROPERTY $
   ;set %endPos #STRRES - 1
   ;str left #PROPERTY %endPos
   ;set %foundString #STRRES
   ;event SysMessage %foundString obtained.

   ;exevent Drag #FINDID #FINDSTACK
   ;if %lootTypeReturn = 1
   ;   exevent Dropc %myHoldingBag
   ;if %lootTypeReturn = 2
   ;   exevent Dropc %myOtherBag
   ;if %lootTypeReturn = 3
   ;{
   ;   if #FINDTYPE in %lootHolding
   ;      exevent Dropc %myHoldingBag
   ;   if #FINDTYPE in %lootNormal
   ;      exevent Dropc %myOtherBag
   ;   if #FINDTYPE in %lootJewels
   ;      exevent Dropc %myJewelBag
   ;}
   ;wait %waitTime
   ;goto checkForLoot
}

sub OpenTarget
{
   if #CONTID <> %targetID
   {
      gosub SaveLast
      gosub SetTarget
      set #NEXTCPOSX %openLocX
      set #NEXTCPOSY %openLocY
      event Macro 17
      gosub LoadLast
      wait %waitTime
   }
   return
}

sub SubBagUp
{
   set %levelsDeep %levelsDeep + 1
   set %mainContID . %levelsDeep %targetID
   set %mainContType . %levelsDeep %targetType
   set %targetType #FINDTYPE
   set %targetID #FINDID
   return
}

sub SubBagDown
{
   set %targetID %mainContID . %levelsDeep
   set %targetType %mainContType . %levelsDeep
   set %levelsDeep %levelsDeep - 1
   if %levelsDeep = 0
      gosub OpenTarget
   return
}
Last edited by Kaiana on Wed Nov 10, 2010 5:07 am, edited 17 times in total.
♥Kaiana♥ - Administrator of the Heart

Yay for scripting and programming! :)
public bool EasyUOMastery = true;
private double CSharpSkillz = 30.0; //and rising!
User avatar
Ceara
Legendary Scribe
Posts: 234
Joined: Tue May 04, 2010 9:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ceara »

Bonsai seeds :D
"Listen to my music, and hear what it can do. There's something here as strong as life. I know it will reach you." - Neil Peart 2112
TheWatcher
Elder Scribe
Posts: 164
Joined: Wed Nov 11, 2009 12:15 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by TheWatcher »

First off.... Awesome script. I ran with it yesterday before the forum issues, no major bugs.

A few smaller probs sometimes when looting a chest especially when there are two close together it fails to collect the items inside. Also has to be paused when in the house or it loots every secure chest, again no big issue to just pause the script

Also would it be a pain to add arrows?

I'm just knitpicking here, the script is great

TheWatcher
User avatar
Kaiana
Elder Scribe
Posts: 148
Joined: Mon Jul 13, 2009 3:07 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Kaiana »

Bonsai seeds...arrows...got it.

And yeah I forgot to mention, for some reason it has trouble looting one specific kind of chest. It's the kind that when the gump is open it appears as a metal chest with gold edging. For some reason when that kind of chest opens it closes right away and glitches the script. No idea why, been trying to figure out that problem. :)

And yeah the house thing...that's actually the reason I added the pause feature in the first place...because every time I would get home it would just pounce on my chests....hmmmmmm....maybe I should make a filter to search for "Locked Down & Secure" in the properties. ;)

Ideas are good, keep em coming :)
♥Kaiana♥ - Administrator of the Heart

Yay for scripting and programming! :)
public bool EasyUOMastery = true;
private double CSharpSkillz = 30.0; //and rising!
User avatar
Ceara
Legendary Scribe
Posts: 234
Joined: Tue May 04, 2010 9:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ceara »

Thought of a couple more items! The regular white bones, used in Tailor bone armor. Also the red Demon bones, and Arcane Gems. :D

I have not tried it yet, but very intrigued. Anything that helps me save mouse clicks to reduce wrist/hand pain is a lifesaver in itself.

Do the gems go into the gem pouch? Or just stack?

I tried an existing EasyUO script and frankly it's rather slow. It was great at first but then I figured oh what the heck just [claimall to save time. I could drag items off corpses faster than the looter, which was sad. And it especially took longer when there was a stack of monster bodies to dig through, and it couldn't be interrupted.

The script is BM Auto Magic Looting. It's only redeeming quality was to cut corpses, cut leather, then move into backpack. That alone made farming leather to train Tailor easier. And it taught me that you can cut hides on the corpse, to lower stone weight before moving leathers into backpack (something I did not know before). But in other instances, it stinks. Great for solo work, terrible in a group setting.

Oh and that BM looting script is also tied to an item eval script, BMItemEval.euo. You could set it to 1-10 to determine what kind of "junk" items to loot. Wasn't sure if you tied that into your script yet.

Thanks for doing this. I have absolutely no ability for computer programming. I'm an ideas/brainstorming person by nature anyway. :D
"Listen to my music, and hear what it can do. There's something here as strong as life. I know it will reach you." - Neil Peart 2112
User avatar
Efanchenko_MM
Legendary Scribe
Posts: 213
Joined: Mon Aug 11, 2008 4:13 pm
Location: Essex, England

Re: [EasyUO]TEST: KaianaUberLooter

Post by Efanchenko_MM »

Want to thank you Kaiana for your hard work you have put into this, I haven't tried it yet but I will when I can get on!

A really usefull tool that I'm sure will make a lot if not the most of Excelsior get EUO!

Thanks again! :)
EFANCHENKO MM
User avatar
Kaiana
Elder Scribe
Posts: 148
Joined: Mon Jul 13, 2009 3:07 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Kaiana »

Ceara wrote:Thought of a couple more items! The regular white bones, used in Tailor bone armor. Also the red Demon bones, and Arcane Gems. :D
Daemon Bones are already a part of it. :) Arcane gems....regular bones...will add. :)
Ceara wrote:Do the gems go into the gem pouch? Or just stack?
You can have it either way. You can set the gems dropdown to drop them to the gem pouch or either of the loot bags.

Ceara wrote:I tried an existing EasyUO script and frankly it's rather slow. It was great at first but then I figured oh what the heck just [claimall to save time. I could drag items off corpses faster than the looter, which was sad. And it especially took longer when there was a stack of monster bodies to dig through, and it couldn't be interrupted.

The script is BM Auto Magic Looting. It's only redeeming quality was to cut corpses, cut leather, then move into backpack. That alone made farming leather to train Tailor easier. And it taught me that you can cut hides on the corpse, to lower stone weight before moving leathers into backpack (something I did not know before). But in other instances, it stinks. Great for solo work, terrible in a group setting.

Oh and that BM looting script is also tied to an item eval script, BMItemEval.euo. You could set it to 1-10 to determine what kind of "junk" items to loot. Wasn't sure if you tied that into your script yet.

Thanks for doing this. I have absolutely no ability for computer programming. I'm an ideas/brainstorming person by nature anyway. :D

Yeah I used to use BMAutomaticLooting too, and that's what inspired me to make my own. This script is not really faster yet, but I hope that eventually it will be. Right now I'd say it's about the same speed. But it can be interrupted and will go back to looting without much problem. And yes, I've been planning to add something to sort through crap items and find those gems with lots of bonuses :)

Honestly though if you want really fast looting, just use my corpsecheck script and change the line that makes you say [claim to say [claimall ;)
♥Kaiana♥ - Administrator of the Heart

Yay for scripting and programming! :)
public bool EasyUOMastery = true;
private double CSharpSkillz = 30.0; //and rising!
TheWatcher
Elder Scribe
Posts: 164
Joined: Wed Nov 11, 2009 12:15 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by TheWatcher »

Couple of things....

It doesnt seem to loot garg knives also whenever a mob is "out of sight" it crashes client....

Good fun to play with... giving me a reason to hunt elsewhere :)
User avatar
Efanchenko_MM
Legendary Scribe
Posts: 213
Joined: Mon Aug 11, 2008 4:13 pm
Location: Essex, England

Re: [EasyUO]TEST: KaianaUberLooter

Post by Efanchenko_MM »

Great job Kaiana, have played with this and it makes looting that much easier that I think I will use this all the time!

I have come across one problem, When this is run with the Heal script by Blaze on here when it loots the corpse and you are being healed it sometimes crashes, so word of warning for everyone out there who want to use both, I died from crashing but no biggie to get back into the game.
EFANCHENKO MM
User avatar
Fiacha
Grandmaster Scribe
Posts: 91
Joined: Sat Aug 22, 2009 1:39 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Fiacha »

As an original tester of this script XD I have made tons of suggestions to Kai to improve it she is always changing it and I assure you this is not the last version of it. I do not use it with ANY other scripts running and find myself with minor crashes. I usually use it in travesty to loot the keys and gold, it does regs too if you want but really I'd only advice looting those if you have a bag of holding, which I do not. I also like to use it in sanctuary because it loots gargoyle axes, which sometimes I miss due to laziness or not wanting to wait for the lag to end to show me that a pick axe is really a garg axe lol. It is also handy to just turn on when you are looting a peerless like travesty, it searches for the crimson cincture and the imprisoned dog. it's really one of those scripts that I like to use when I am killing too many things and don't want to loot them one by one lol or when I have killed something with far too many items on it to check individually. Okie I love you Bye bye!
Liina
Passer by
Posts: 4
Joined: Tue Sep 21, 2010 3:59 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Liina »

Cool! Does it do paragon chests and treasure maps?
User avatar
Fiacha
Grandmaster Scribe
Posts: 91
Joined: Sat Aug 22, 2009 1:39 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Fiacha »

Liina wrote:Cool! Does it do paragon chests and treasure maps?
It uses untrap and unlock spells to do treasure chests so if the chest requires you use lock picks then no it will not open it but it will loot it I believe give it a try and make some suggestions
TheWatcher
Elder Scribe
Posts: 164
Joined: Wed Nov 11, 2009 12:15 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by TheWatcher »

In my experience it doesnt do tchests but if you pick a para chest drop it on the ground it will loot it.

Another thing ive noticed is it doesnt loot runic flethers tools :)
User avatar
Ceara
Legendary Scribe
Posts: 234
Joined: Tue May 04, 2010 9:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ceara »

Hiya

Just tried the script, and it's way faster than the BMAutoMagic!

But it's not picking up Common and Uncommon seeds from the Deathwatch Beetles. That was one of the things I was hoping for!

Will continue testing but so far it's wonderful! Thank you.
"Listen to my music, and hear what it can do. There's something here as strong as life. I know it will reach you." - Neil Peart 2112
ticketguru
Grandmaster Scribe
Posts: 99
Joined: Fri Jun 12, 2009 11:25 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by ticketguru »

The script works great - wonderful.

Just a couple of things - add looting of the Dreadhorn keys from twisted weald. The Lissith silk and Irks brain are already picked up because their object types already match other items being looted, but the Gnaws fang and Sabrixs eye could be picked up.

Another would be opening bags or pouches being carried on a corpse and looting that as well. Both Irk and Juka Lords carry a bag or pouch that contains other items (probably other mobs too, but can't think of them right now).

Thanks for the great work.
Locked