Back to "snippet" tags

Vendor - Platemail Set Bag Filler by jfrostp

Related: Snippet vendor

Description: Auto-fills backpacks with platemail sets for your vendor. Can do all material types simultaneously by using color-coded bags, but you must set the hues in the script variables. Will turn 100 loose platemail pieces in your backpack into beautifully arranged plate set bags, ready to sell

1# Auto platemail vendor bags by Frost
2# How to use this script:
3# 1) Set all the bag hue values to the dye colors you use
4# 2) Optionally, set the sourceBag and destinationBag variables to permanent values for convenience
5#
6# NOTES:
7# ***THE SOURCE AND DESTINATION BAGS MUST BE DIFFERENT!***
8# The script will halt if it encounters a non-exceptional item
9# Any pieces that do not have a bag will remain in the source bag
10
11# Set this to the container with your plate pieces
12setvar! sourceBag
13# Set this to the container with your dyed bags
14setvar! destinationBag
15
16setvar! delay 400
17
18# Set the values below to the hues you dye your bags to (use >info to get the hues)
19setvar! ironBagHue 0
20setvar! dullCopperBagHue 993
21setvar! shadowBagHue 803
22setvar! copperBagHue 648
23setvar! bronzeBagHue 543
24setvar! goldBagHue 248
25setvar! agapiteBagHue 708
26setvar! veriteBagHue 568
27setvar! valoriteBagHue 488
28setvar! avariteBagHue 513
29
30removelist plateHues
31createlist plateHues
32pushlist plateHues 0
33pushlist plateHues 2419
34pushlist plateHues 2406
35pushlist plateHues 2413
36pushlist plateHues 2418
37pushlist plateHues 2213
38pushlist plateHues 2425
39pushlist plateHues 2207
40pushlist plateHues 2219
41pushlist plateHues 1763
42
43removelist bagHues
44createlist bagHues
45pushlist bagHues ironBagHue 
46pushlist bagHues dullCopperHue 
47pushlist bagHues shadowBagHue 
48pushlist bagHues copperBagHue 
49pushlist bagHues bronzeBagHue 
50pushlist bagHues goldBagHue 
51pushlist bagHues agapiteBagHue 
52pushlist bagHues veriteBagHue 
53pushlist bagHues valoriteBagHue 
54pushlist bagHues avariteBagHue 
55
56removelist plateTypes
57createlist plateTypes
58pushlist plateTypes 5138
59pushlist plateTypes 5139
60pushlist plateTypes 5142
61pushlist plateTypes 5143
62pushlist plateTypes 5144
63pushlist plateTypes 5146
64
65@clearignore 
66cleardragdrop
67
68while list plateHues > 0
69    foreach color in plateHues
70        setvar! plateColor color
71        break
72    endfor
73    if poplist plateHues front as throwaway
74    endif
75    
76    # Commence janky syntax to get our array values
77    foreach color in bagHues
78        setvar! bagColor color
79        break
80    endfor
81    if poplist bagHues front as throwaway
82    endif
83        
84    removelist xPositions
85    createlist xPositions
86    pushlist xPositions 0
87    pushlist xPositions 75
88    pushlist xPositions 100
89    pushlist xPositions 0
90    pushlist xPositions 400
91    pushlist xPositions 400
92
93    removelist yPositions
94    createlist yPositions
95    pushlist yPositions 0
96    pushlist yPositions 85
97    pushlist yPositions 95
98    pushlist yPositions 400
99    pushlist yPositions 0
100    pushlist yPositions 400
101
102    removelist tempTypes
103    createlist tempTypes
104    
105    # Cycle through item types to find them bags
106    setvar! itemType 0
107    while list plateTypes > 0
108        foreach x in xPositions
109            setvar! itemX x
110            break
111        endfor
112        if poplist xPositions front as throwaway
113        endif
114        foreach y in yPositions
115            setvar! itemY y
116            break
117        endfor
118        if poplist yPositions front as throwaway
119        endif
120        
121        foreach type in plateTypes
122            setvar! itemType type
123            break
124        endfor
125        if poplist plateTypes front as throwaway
126        endif
127        pushlist tempTypes itemType
128        
129        while findtype itemType sourceBag plateColor as item
130            getlabel item itemLabel
131            if "master" in itemLabel
132            else
133                sysmsg 'Non-exceptional item found, stopping script:' 33
134                sysmsg itemLabel 33
135                sysmsg 'Hue:' 33
136                sysmsg plateColor 33
137                stop
138            endif
139        
140            # Find a bag that needs this color plate piece
141            setvar! foundBagForItem 0
142            while findtype 3701|3702 destinationBag bagColor as plateBag
143                if findtype itemType plateBag
144                else
145                    lift item 1
146                    wait delay
147                    drop plateBag itemX itemY
148                    wait delay
149                    setvar! foundBagForItem 1
150                    break
151                endif
152                @ignore plateBag
153            endwhile
154            
155            @clearignore
156            if foundBagForItem = 0
157                #overhead 'Not enough bags'
158                break
159            endif
160        endwhile
161    endwhile
162    
163    foreach tempType in tempTypes
164        pushlist plateTypes tempType
165    endfor
166endwhile
167
168sysmsg 'Done filling platemail bags'
169
170@clearignore
171cleardragdrop