Back to "trap" tags

Open Dungeon Chest or Treasure Map Chest by Jaseowns

1# Open Chest or TMap by Jaseowns
2# UO Outlands - uorazorscripts.com
3# Credit: based on Auto Dungeon or TMap Chest by @FewUnderstandThis
4# Description: Opens and loots chest without needing to be hidden
5
6clearsysmsg
7unsetvar chest
8setvar! locked 0
9setvar! trapped 0
10
11# Create loot list
12if not listexists 'lootTypes'
13    overhead 'Compiling list...' 1150
14    createlist 'lootTypes'
15    # Gold
16    pushlist 'lootTypes' 0xeed
17    # Chain Link
18    pushlist 'lootTypes' 0xa8c6
19    # MCD
20    pushlist 'lootTypes' 0x42bf
21    # Mastery Scroll
22    pushlist 'lootTypes' 0x227a
23    # Aspect Extract
24    pushlist 'lootTypes' 0xefc
25    # Aspect Core
26    pushlist 'lootTypes' 0xf91
27    # Skill Orb
28    pushlist 'lootTypes' 0x5740
29    # Skill Scroll
30    pushlist 'lootTypes' 0xef3
31    # Research Mats
32    pushlist 'lootTypes' 0x72a4
33    # Tmap
34    pushlist 'lootTypes' 0x14ec
35    
36    # Black Pearl
37    pushlist 'lootTypes' 0xf7a
38    # Blood Moss
39    pushlist 'lootTypes' 0xf7b
40    # Mandrake Root
41    pushlist 'lootTypes' 0xf86
42    # Garlic
43    pushlist 'lootTypes' 0xf84
44    # Ginseng
45    pushlist 'lootTypes' 0xf85
46    # Nightshade
47    pushlist 'lootTypes' 0xf88
48    # Spiders Silk
49    pushlist 'lootTypes' 0xf8d
50    # Sulphurous Ash
51    pushlist 'lootTypes' 0xf8c
52    
53    # Amber
54    pushlist 'lootTypes' 0xf25
55    # Amethyst
56    pushlist 'lootTypes' 0xf16
57    # Citrine
58    pushlist 'lootTypes' 0xf15
59    # Diamond
60    pushlist 'lootTypes' 0xf26
61    # Emerald
62    pushlist 'lootTypes' 0xf10
63    # Ruby
64    pushlist 'lootTypes' 0xf13
65    # Sapphire
66    pushlist 'lootTypes' 0xf19
67    # Star Sapphire
68    pushlist 'lootTypes' 0xf21
69    # Tourmaline
70    pushlist 'lootTypes' 0xf2d
71    
72    # Magic spellbook
73    pushlist 'lootTypes' 0xefa
74    
75    # Arrows
76    pushlist 'lootTypes' 0xf3f
77    # Bandages
78    pushlist 'lootTypes' 0xe21
79    # Bolts
80    pushlist 'lootTypes' 0x1bfb
81endif
82
83# Set loot bag
84if not find lootBag backpack
85    overhead 'Set Loot Bag:' 1150
86    setvar! lootBag
87    wait 250
88endif
89
90# Look for chest
91if findtype 'metal chest' ground any any 2 as metalChest
92    setvar! chest metalChest
93elseif findtype 'wooden chest' ground any any 2 as woodenChest
94    setvar! chest woodenChest
95endif
96getlabel chest chestLabel
97wait 100
98if 'dungeon chest' in chestLabel or 'treasure map chest' in chestLabel
99    overhead chestLabel 1150
100else
101    overhead 'No chest found!' 38
102    stop
103endif
104
105# Open chest
106dclick chest
107waitforgump 736038070 500
108if gumpexists 736038070
109    setvar! locked 1
110    setvar! trapped 1
111else
112    overhead 'Chest not locked!' 38
113    overhead 'Target chest to continue looting:' 38
114    setvar chest
115endif
116
117# Remove trap
118while trapped = 1
119    gumpresponse 7
120    wait 250
121    if insysmsg 'cleared it of traps' or insysmsg 'devoid of traps'
122        overhead 'Trap removed!' 1150
123        setvar! trapped 0
124        break
125    elseif insysmsg 'attempt to remove traps'
126        overhead 'Removing trap...' 1150
127        for 15
128            if insysmsg 'cleared it of traps' or insysmsg 'devoid of traps'
129                break
130            else
131                wait 250
132            endif
133        endfor
134    else
135        overhead 'Check Script!' 38
136        wait 250
137    endif
138endwhile
139wait 250
140
141# Pick lock
142while locked = 1
143    gumpresponse 4
144    wait 250
145    if not gumpexists 736038070 or insysmsg 'successfully pick the lock'
146        overhead 'Lock picked!' 1150
147        setvar! locked 0
148        break
149    elseif insysmsg 'attempt to pick the lock'
150        overhead 'Picking lock...' 1150
151        for 15
152            if insysmsg 'successfully pick the lock'
153                break
154            else
155                wait 250
156            endif
157        endfor
158    else
159        overhead 'Check Script!' 38
160        wait 250
161    endif
162endwhile
163wait 250
164
165# Loot
166overhead 'Looting...' 1150
167foreach t in 'lootTypes'
168    while findtype t chest as loot
169        getlabel loot lootLabel
170        overhead lootLabel 1150
171        lift loot 60000
172        drop lootBag -1 -1 -1
173        wait 500
174    endwhile
175endfor
176
177unsetvar chest
178overhead 'Script Complete!' 1150