[EasyUO]TEST: KaianaUberLooter

If you make a Client-side script you can publish it here for other players to use
Shotta
Legendary Scribe
Posts: 295
Joined: Thu Mar 10, 2011 2:04 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Shotta »

Relysis wrote:For anyone that still uses this, I have an issue.

When selecting my top level bag for stackables, the script constantly picks up and moves items around the bag. Setting them to another bag works fine, but nothing gets added to the keys. Arrows also aren't being looted for some reason.

Any ideas? Thanks in advance. This coding is new to me, so I'm having trouble picking out exactly what needs to be edited.
Turn off (uncheck) clean up inventory, and it will stop moving things around in your main pack.
User avatar
Ilsanor
Legendary Scribe
Posts: 407
Joined: Tue Jun 07, 2011 5:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ilsanor »

Key adding is not implemented (Kaiana was supposed to work on this, but disappeared). Select Arrows in the setup to loot them.
Relysis
Grandmaster Scribe
Posts: 85
Joined: Tue Apr 10, 2012 4:48 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Relysis »

Thanks all for the helpful responses. Disabling the inventory clean-up stopped the constant moving. It seems to be working well so far.

Also, when you set all your bags to be the top level of your backpack, you can run the Storage script here on the forum in EasyEUO. That adds the stackables to my keys just fine.
User avatar
Riddlebox
Master Scribe
Posts: 61
Joined: Wed Feb 23, 2011 6:45 pm
Location: Arizona

Re: [EasyUO]TEST: KaianaUberLooter

Post by Riddlebox »

Just started using this, and I gotta say, works great. :)

Im only coming across one problem. Whenever I am hunting in Sgail with this running it constantly loots the sandals the Umbris wear, I'm guessing because there is a code somewhere in here that loots Batwings off Neto. In the options I tried making it not loot 'Sanctuary' items thinking this might solve the problem, but it did not. I guess I could just add an organizer with razor to trash sandals, but I was just wondering if anyone knew how to fix this, or knew where to remove the code for sandals in the script before I did. Thank you very much in advance, and again, great work Kaiana. :)
User avatar
Ilsanor
Legendary Scribe
Posts: 407
Joined: Tue Jun 07, 2011 5:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ilsanor »

Two ways to go about this. Either turn off looting Peerless Non-Stackables* or find the line:

Code: Select all

set %peerlessnonstacks PZH_SVH_ETD_BTD_TML_WML_HXF_TXF_XDI_EWH_FSF_NVI_WRH_SJG_UJG_DCI_
and delete NVI_ (which is the itemcode for the sandals and Batwings). Basically just change the line to:

Code: Select all

set %peerlessnonstacks PZH_SVH_ETD_BTD_TML_WML_HXF_TXF_XDI_EWH_FSF_WRH_SJG_UJG_DCI_
There was supposed to be some sort of coding to differentiate between good drops and regular useless items, but I guess it either doesn't work or was not implemented. Never got that deep into the script to check which one is it.

*If you look for the line in the script there is a commented section telling you which items fall into that category.
User avatar
Riddlebox
Master Scribe
Posts: 61
Joined: Wed Feb 23, 2011 6:45 pm
Location: Arizona

Re: [EasyUO]TEST: KaianaUberLooter

Post by Riddlebox »

Ahh thank you very much, its funny, I was actually about to do just that before I posted, but I wasn't quite sure enough to try. :P

Works like a charm now. :)

Edit: Apparently that did not work lol, my bad, didnt see the sandals in my pack at first but they are definitely still being looted. I'll just turn it off. :)
davvol
Passer by
Posts: 3
Joined: Sun Jun 05, 2011 1:23 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by davvol »

Riddle, you will need to go through the looter config again after making the suggested changes. I believe it compiles a list of lootables and saves it elsewhere, and it only gets updated when you go through the config screens again and re-save the settings.
Shotta
Legendary Scribe
Posts: 295
Joined: Thu Mar 10, 2011 2:04 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Shotta »

whenever you edit a line in this script, you have to decheck, restart, pause, then recheck the box again so it knows what has been edited.
User avatar
Ilsanor
Legendary Scribe
Posts: 407
Joined: Tue Jun 07, 2011 5:47 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Ilsanor »

Ah yes, completely forgot about that. It does save all the itemcodes to the registry, so you do have to update the setup for the effects in the script to actually take place in game. My bad. Forgot that step since I do it on auto. ;)

Just as a side note - the itemtypes are saved both as a general list (*SAVEDLOOTALL) and lists for specific containers (*SAVEDLOOTHOLDING (Stackables), *SAVEDLOOTJEWELS (Jewels), *SAVELOOTNORMAL (Non-Stackables). If you wanted to remove an item by registry edit instead of in-game setup (no idea why you'd want that... ;) ) then you basically have to remove the code from both the 'ALL' master list and the specific list for the item in question (NORMAL for sandals for example).
Relysis
Grandmaster Scribe
Posts: 85
Joined: Tue Apr 10, 2012 4:48 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Relysis »

I've made some minor tweaks to this great script that I thought others may find useful.

Code: Select all

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

    set %version 0.91d
    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 - Relysis Tweaks

    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_DPF_
    set %filters UJG_ZRF_GMH_QPF_RMH_XMF_POL_IJG_GMF_FSF_EWH_MPF_PZF_XDI_SEG_REG_CFG_DCI_YWL_ZWF_RZF_LWL_NVI_FIL_
    set %bandages ZLF_

    ;============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), Fertile Dirt
    set %regs KUF_JUF_KZF_JZF_MZF_WZF_RZF_SZF_PLF_WLF_IND_NZF_

    ;============NECRO REGS,
    ;Necro Regs, Bones
    set %necroregs YZF_IUF_DUF_UZF_TZF_GUF_

    ;============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 = 0
          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 520                                         ;
       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 chkNecroRegs 0 240 180 20 #true Necro Regs            ;
       menu Combo Create cmbNecroRegs 220 240 120                       ;
       menu Combo Add cmbNecroRegs Stackables                           ;
       menu Combo Add cmbNecroRegs Non-Stackables                       ;
       menu Combo Select cmbNecroRegs 1                                 ;                                                                 ;
                                                                        ;
       menu Check chkPeerlessNonstacks 0 260 180 20 #true Peerless Non-Stackables
       menu Combo Create cmbPeerlessNonstacks 220 260 120               ;
       menu Combo Add cmbPeerlessNonstacks Stackables                   ;
       menu Combo Add cmbPeerlessNonstacks Non-Stackables               ;
       menu Combo Select cmbPeerlessNonstacks 2                         ;
                                                                        ;
       menu Check chkPeerlessStacks 0 280 180 20 #true Peerless Stackables
       menu Combo Create cmbPeerlessStacks 220 280 120                  ;
       menu Combo Add cmbPeerlessStacks Stackables                      ;
       menu Combo Add cmbPeerlessStacks Non-Stackables                  ;
       menu Combo Select cmbPeerlessStacks 1                            ;
                                                                        ;
       menu Check chkMagePrism 0 300 180 20 #true Prism of Light Items  ;
       menu Combo Create cmbMagePrism 220 300 120                       ;
       menu Combo Add cmbMagePrism Stackables                           ;
       menu Combo Add cmbMagePrism Non-Stackables                       ;
       menu Combo Select cmbMagePrism 2                                 ;
                                                                        ;
       menu Check chkMageBlight 0 320 180 20 #true Blighted Grove Items ;
       menu Combo Create cmbMageBlight 220 320 120                      ;
       menu Combo Add cmbMageBlight Stackables                          ;
       menu Combo Add cmbMageBlight Non-Stackables                      ;
       menu Combo Select cmbMageBlight 2                                ;
                                                                        ;
       menu Check chkMageBedlam 0 340 180 20 #true Bedlam Items         ;
       menu Combo Create cmbMageBedlam 220 340 120                      ;
       menu Combo Add cmbMageBedlam Stackables                          ;
       menu Combo Add cmbMageBedlam Non-Stackables                      ;
       menu Combo Select cmbMageBedlam 2                                ;
                                                                        ;
       menu Check chkMageSanc 0 360 180 20 #true Sanctuary Items        ;
       menu Combo Create cmbMageSanc 220 360 120                        ;
       menu Combo Add cmbMageSanc Stackables                            ;
       menu Combo Add cmbMageSanc Non-Stackables                        ;
       menu Combo Select cmbMageSanc 2                                  ;
                                                                        ;
       menu Check chkMageLaby 0 380 180 20 #true Labyrinth Items        ;
       menu Combo Create cmbMageLaby 220 380 120                        ;
       menu Combo Add cmbMageLaby Stackables                            ;
       menu Combo Add cmbMageLaby Non-Stackables                        ;
       menu Combo Select cmbMageLaby 2                                  ;
                                                                        ;
       menu Check chkMageParox 0 400 180 20 #true Paroxysmus Items      ;
       menu Combo Create cmbMageParox 220 400 120                       ;
       menu Combo Add cmbMageParox Stackables                           ;
       menu Combo Add cmbMageParox Non-Stackables                       ;
       menu Combo Select cmbMageParox 2                                 ;
                                                                        ;
       menu Check chkSeeds 0 420 180 20 #true Seeds      ;
       menu Combo Create cmbSeeds 220 420 120                       ;
       menu Combo Add cmbSeeds Stackables                           ;
       menu Combo Add cmbSeeds Non-Stackables                       ;
       menu Combo Select cmbSeeds 2                                  ;
                                                                         ;
       menu Check chkArcaneGems 0 440 180 20 #true Arcane Gems      ;
       menu Combo Create cmbArcaneGems 220 440 120                       ;
       menu Combo Add cmbArcaneGems Stackables                           ;
       menu Combo Add cmbArcaneGems Non-Stackables                       ;
       menu Combo Select cmbArcaneGems 2                                 ;
                                                                         ;
       menu Check chkArrows 0 460 180 20 #true Arrows      ;
       menu Combo Create cmbArrows 220 460 120                       ;
       menu Combo Add cmbArrows Stackables                           ;
       menu Combo Add cmbArrows Non-Stackables                       ;
       menu Combo Select cmbArrows 1                                 ;
                                                                       ;
       menu Check chkBandages 0 480 180 20 #true Bandages      ;
       menu Combo Create cmbBandages 220 480 120                       ;
       menu Combo Add cmbBandages Stackables                           ;
       menu Combo Add cmbBandages Non-Stackables                       ;
       menu Combo Select cmbBandages 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 chkNecroRegs cmbNecroRegs *lootingNecroRegs                     ;
       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       ;
       gosub SetState chkBandages cmbBandages *lootingBandages           ;
                                                                        ;
       menu Button btnDone 220 500 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
          
          ;Necro Regs
          gosub GetState chkNecroRegs cmbNecroRegs %necroregs
          set *lootingNecroRegs #result

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

          ;Bandages
          gosub GetState chkBandages cmbBandages %bandages
          set *lootingBandages #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 FIL_ ;Dismembered Torso
          {
             if Dismembered notin #PROPERTY
                return 0
             return *lootingPeerlessKeys
          }
          if #FINDTYPE in NVI_ ;Bat Wings
          {
             if Bat , #spc , Wings notin #PROPERTY
                return 0
             return *lootingPeerlessNonstacks
          }
          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
    }
Additions:

- Necro reagents: can turn on or off and select bag from the items menu
- Bones
- Bandages: can turn on or off and select bag from the Items menu
- Blank Scrolls
- Fertile Dirt
- Loots Bat Wings, not regular Sandals
- Loots Dismembered Torso, not regular Torso
- Opens setup dialogue by default: hit save to use previous settings
Last edited by Relysis on Sun Jul 01, 2012 8:54 pm, edited 1 time in total.
HarmBringer
Adept Scribe
Posts: 49
Joined: Thu Sep 29, 2011 9:45 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by HarmBringer »

Wow Great. Ty for the edit.. Could it be possible to also COmpletely remove Keys from this Script since they dont work anyway while making the script more complex... Oh also I found that it loots Chest part of the Body Parts from Death Wisps (Kronos Champ)... Idk if u can turn it off in Item Selection or not but is a little annoying :/
Relysis
Grandmaster Scribe
Posts: 85
Joined: Tue Apr 10, 2012 4:48 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by Relysis »

HarmBringer wrote:Wow Great. Ty for the edit.. Could it be possible to also COmpletely remove Keys from this Script since they dont work anyway while making the script more complex... Oh also I found that it loots Chest part of the Body Parts from Death Wisps (Kronos Champ)... Idk if u can turn it off in Item Selection or not but is a little annoying :/
Yeah, I use the OpenEUO storageApp for key gathering myself, and it works fine. If I remove the extra code, I'll post it here. You're right about the wisps. I changed it to only loot dismembered torsos. The new code is edited in the post above.
ticketguru
Grandmaster Scribe
Posts: 99
Joined: Fri Jun 12, 2009 11:25 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by ticketguru »

Thanks Relysis for your fixes and changes. I merged yours in with a fixed version that I had been working on and found a few more tweaks while doing that. Here is an update:

Code: Select all

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

    set %version 0.92a
    set %build 12.07.02

    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
    ;New in version 0.91c - Added Gem Pouch for Arcane Gems; increased wait time
    ;New in version 0.92 - added necro and bandages; fixed some filters; merged Relysis changes
    ;fix in version 0.92a - correctly id ointments/essences/spring water
    ;                     - fixes for setup
    ;                     - remove Auto key code
    event SysMessage New in version %version - Item id updates/Ticketguru

    set %testX #SCNT2
    set *isDone 1

    ;set IMPORTANT bag variables
    set %waitTime 12
    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_NZF_ ;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 WLF_UJG_ZRF_GMH_QPF_RMH_XMF_POL_IJG_GMF_FSF_EWH_MPF_PZF_XDI_SEG_REG_CFG_DCI_YWL_ZWF_RZF_LWL_NVI_PZH_FIL_
    set %bandages ZLF_

    ;============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), Fertile Dirt, Bones
    set %regs KUF_JUF_KZF_JZF_MZF_WZF_RZF_SZF_PLF_IND_GUF_NZF_WLF_
    
    ;============NECRO REGS,
    ;Necro Regs
    set %necroregs YZF_IUF_DUF_UZF_TZF_

    ;============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 = 0
          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 520                                         ;
       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 chkNecroRegs 0 240 180 20 #true Necro Regs            ;
       menu Combo Create cmbNecroRegs 220 240 120                       ;
       menu Combo Add cmbNecroRegs Stackables                           ;
       menu Combo Add cmbNecroRegs Non-Stackables                       ;
       menu Combo Select cmbNecroRegs 1                                 ;                                                                 ;
                                                                            ;
       menu Check chkPeerlessNonstacks 0 260 180 20 #true Peerless Non-Stackables
       menu Combo Create cmbPeerlessNonstacks 220 260 120               ;
       menu Combo Add cmbPeerlessNonstacks Stackables                   ;
       menu Combo Add cmbPeerlessNonstacks Non-Stackables               ;
       menu Combo Select cmbPeerlessNonstacks 2                         ;
                                                                        ;
       menu Check chkPeerlessStacks 0 280 180 20 #true Peerless Stackables
       menu Combo Create cmbPeerlessStacks 220 280 120                  ;
       menu Combo Add cmbPeerlessStacks Stackables                      ;
       menu Combo Add cmbPeerlessStacks Non-Stackables                  ;
       menu Combo Select cmbPeerlessStacks 1                            ;
                                                                        ;
       menu Check chkMagePrism 0 300 180 20 #true Prism of Light Items  ;
       menu Combo Create cmbMagePrism 220 300 120                       ;
       menu Combo Add cmbMagePrism Stackables                           ;
       menu Combo Add cmbMagePrism Non-Stackables                       ;
       menu Combo Select cmbMagePrism 2                                 ;
                                                                        ;
       menu Check chkMageBlight 0 320 180 20 #true Blighted Grove Items ;
       menu Combo Create cmbMageBlight 220 320 120                      ;
       menu Combo Add cmbMageBlight Stackables                          ;
       menu Combo Add cmbMageBlight Non-Stackables                      ;
       menu Combo Select cmbMageBlight 2                                ;
                                                                        ;
       menu Check chkMageBedlam 0 340 180 20 #true Bedlam Items         ;
       menu Combo Create cmbMageBedlam 220 340 120                      ;
       menu Combo Add cmbMageBedlam Stackables                          ;
       menu Combo Add cmbMageBedlam Non-Stackables                      ;
       menu Combo Select cmbMageBedlam 2                                ;
                                                                        ;
       menu Check chkMageSanc 0 360 180 20 #true Sanctuary Items        ;
       menu Combo Create cmbMageSanc 220 360 120                        ;
       menu Combo Add cmbMageSanc Stackables                            ;
       menu Combo Add cmbMageSanc Non-Stackables                        ;
       menu Combo Select cmbMageSanc 2                                  ;
                                                                        ;
       menu Check chkMageLaby 0 380 180 20 #true Labyrinth Items        ;
       menu Combo Create cmbMageLaby 220 380 120                        ;
       menu Combo Add cmbMageLaby Stackables                            ;
       menu Combo Add cmbMageLaby Non-Stackables                        ;
       menu Combo Select cmbMageLaby 2                                  ;
                                                                        ;
       menu Check chkMageParox 0 400 180 20 #true Paroxysmus Items      ;
       menu Combo Create cmbMageParox 220 400 120                       ;
       menu Combo Add cmbMageParox Stackables                           ;
       menu Combo Add cmbMageParox Non-Stackables                       ;
       menu Combo Select cmbMageParox 2                                 ;

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

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

       menu Check chkArrows 0 460 180 20 #true Arrows      ;
       menu Combo Create cmbArrows 220 460 120                       ;
       menu Combo Add cmbArrows Stackables                           ;
       menu Combo Add cmbArrows Non-Stackables                       ;
       menu Combo Select cmbArrows 1                                 ;
                                                                           ;
       menu Check chkBandages 0 480 180 20 #true Bandages      ;
       menu Combo Create cmbBandages 220 480 120                       ;
       menu Combo Add cmbBandages Stackables                           ;
       menu Combo Add cmbBandages Non-Stackables                       ;
       menu Combo Select cmbBandages 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 chkNecroRegs cmbNecroRegs *lootingNecroRegs                     ;
       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       ;
       gosub SetState chkBandages cmbBandages *lootingBandages           ;
                                                                        ;
       menu Button btnDone 220 500 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

          ;Necro Regs
          gosub GetState chkNecroRegs cmbNecroRegs %necroregs
          set *lootingNecroRegs #result

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

          ;Bandages
          gosub GetState chkBandages cmbBandages %bandages
          set *lootingBandages #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 1
              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

       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 FIL_ ;Dismembered Torso
          {
             if Dismembered notin #PROPERTY
                return 0
             return *lootingPeerlessKeys
          }
          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 in #PROPERTY || Essence , #spc , Of in #PROPERTY
                return *lootingOints
	     if Radioactive , #spc , Material in #PROPERTY
             	return *lootingMageParox
	     if Spring , #spc , Water in #PROPERTY
	     	return *lootingRegs
	     return 0
          }
          if #FINDTYPE in RZF_ ;Spider's Silk/Lissith's Silk
          {
             if Lissith notin #PROPERTY
             {
                if #FINDTYPE notin %regs
                   return 0
                return *lootingRegs
             }
             return *lootingKeys

          }
          if #FINDTYPE in NVI_ ;batwing
          {
             if Bat , #spc , Wings notin #PROPERTY
                return 0
             return *lootingPeerlessNonstacks
          }
          if #FINDTYPE in PZH_ ;mark of travesty
          {
             if Travesty notin #PROPERTY
                return 0
             return *lootingPeerlessNonstacks
          }
          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
    }


    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
    }
Shotta
Legendary Scribe
Posts: 295
Joined: Thu Mar 10, 2011 2:04 am

Re: [EasyUO]TEST: KaianaUberLooter

Post by Shotta »

Not Bad. The only thing this script does that's always bugged me is ;
When you check the box for "Use lockpicks instead of magic"
It should also use the remove trap/ disarming skill as well,
Instead of casting remove trap.

Just my 2 cents :D
ticketguru
Grandmaster Scribe
Posts: 99
Joined: Fri Jun 12, 2009 11:25 pm

Re: [EasyUO]TEST: KaianaUberLooter

Post by ticketguru »

Your correct. I have been working on getting my disarm up and was going to look at changing the script to do that. Also a filter on the chest types, it currently tries to open Exex drop boxes, seed boxes and a few others that are not really lootable chests.
Locked