Back to "trap" tags

Auto Dungeon or TMap Chest by FewUnderstandThis

Description: Opens and loots chest with hiding checks

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