Fill potions from kegs by Nevor
Description: I hope this helps new players, who do not yet own a storage shelf, to refill their potions easier and faster after consuming dungeon runs
1########## MANUAL INPUT ##########
2# Please set the amount of pots #
3# you want to fill down below #
4# Empty bottles have to be prov- #
5# ided manually #
6##################################
7#Heal/Yellow potions
8@setvar! healpots 10
9#Orange/Cure potions
10@setvar! curepots 10
11#Red/Stamina potions
12@setvar! redpots 10
13#White/Strength potions
14@setvar! whitepots 0
15#Blue/Agility potions
16@setvar! bluepots 0
17#Black/Resist Magic potions
18@setvar! blackpots 0
19#Purple/Explosive potions
20@setvar! purplepots 0
21#Green/Poison potions
22@setvar! greenpots 0
23
24# The script will first check your backpack for kegs, then the ground.
25# If there are no kegs found you can define a specific container via target cursor.
26# That specific container is stored as a persistent variable.
27# If you want to use the bank box directly, without using a separate container inside, targeting yourself seems to work (no idea why)
28
29########## START SCRIPT ##########
30# NO CHANGES NEEDED FROM HERE ON #
31##################################
32overhead 'Filling potions from kegs'
33
34//counts up to cycle through potion types
35@setvar! myrestockcounter 0
36//short global wait-time variable in ms
37@setvar! alittlebit 50
38//long global wait-time variable in ms
39@setvar! abit 250
40
41//Main loop through the different potion types as long as we have empty bottles
42while myrestockcounter < 8 and findtype 'empty bottle%s%' backpack
43 if myrestockcounter = 0
44 //Yellow potions
45 @setvar! serialofpotion 3852
46 @setvar! colorofkeg 253
47 @setvar! amounttorestock healpots
48 @setvar! myrestockcounter 1
49 elseif myrestockcounter = 1
50 //Orange potions
51 @setvar! serialofpotion 3847
52 @setvar! colorofkeg 44
53 @setvar! amounttorestock curepots
54 @setvar! myrestockcounter 2
55 elseif myrestockcounter = 2
56 //Red potions
57 @setvar! serialofpotion 3851
58 @setvar! colorofkeg 37
59 @setvar! amounttorestock redpots
60 @setvar! myrestockcounter 3
61 elseif myrestockcounter = 3
62 //White potions
63 @setvar! serialofpotion 3849
64 @setvar! colorofkeg 956
65 @setvar! amounttorestock whitepots
66 @setvar! myrestockcounter 4
67 elseif myrestockcounter = 4
68 //Blue potions
69 @setvar! serialofpotion 3848
70 @setvar! colorofkeg 93
71 @setvar! amounttorestock bluepots
72 @setvar! myrestockcounter 5
73 elseif myrestockcounter = 5
74 //Black potions
75 @setvar! serialofpotion 3846
76 @setvar! colorofkeg 1109
77 @setvar! amounttorestock blackpots
78 @setvar! myrestockcounter 6
79 elseif myrestockcounter = 6
80 //Purple potions
81 @setvar! serialofpotion 3853
82 @setvar! colorofkeg 419
83 @setvar! amounttorestock purplepots
84 @setvar! myrestockcounter 7
85 elseif myrestockcounter = 7
86 //Green potions
87 @setvar! serialofpotion 3850
88 @setvar! colorofkeg 363
89 @setvar! amounttorestock greenpots
90 @setvar! myrestockcounter 8
91 endif
92 //loop that looks for kegs and fills up the pots
93 while counttype serialofpotion backpack < amounttorestock
94 //as long as we have bottles
95 if not findtype 'empty bottle%s%' backpack
96 break
97 endif
98 //check our backpack for kegs
99 if findtype 'keg' backpack colorofkeg as myKeg
100 dclick myKeg
101 while queued
102 wait alittlebit
103 endwhile
104 //check the ground for kegs
105 elseif findtype 'keg' ground colorofkeg -1 2 as myKeg
106 dclick myKeg
107 while queued
108 wait alittlebit
109 endwhile
110 //check if a container is already specified
111 elseif varexist KegContainer and findtype 'keg' KegContainer colorofkeg as myKeg
112 dclick myKeg
113 while queued
114 wait alittlebit
115 endwhile
116 else
117 //we either have no KegContainer specified yet, or we cannot find it, and there are no kegs in backpack/on the ground - user input required, target cursor will be going up
118 overhead 'Select container holding your kegs' colorofkeg
119 @setvar KegContainer
120 wait abit
121 while targetexists
122 wait abit
123 endwhile
124 //check if user selected a valid container,
125 if varexist KegContainer
126 dclick KegContainer
127 wait abit
128 //with kegs of the required potion type inside of it
129 if findtype 'keg' KegContainer colorofkeg as myKeg
130 dclick myKeg
131 while queued
132 wait alittlebit
133 endwhile
134 //no keg, no juice
135 else
136 overhead 'No keg found' colorofkeg
137 //switch to the next potion type
138 break
139 endif
140 //Esc pressed
141 else
142 overhead 'Ending script - goodbye'
143 stop
144 endif
145 endif
146 if insysmsg 'You pour some'
147 //juice is flowing,
148 overhead 'Pouring...' colorofkeg
149 clearsysmsg
150 elseif insysmsg 'You must wait'
151 //maybe even a little bit too fast sometimes, all good
152 overhead 'Waiting...' colorofkeg
153 clearsysmsg
154 else
155 //fail, maybe KegContainer variable is broken, needs to be manually reset during next cycle
156 unsetvar KegContainer
157 endif
158 endwhile
159 //Check if potions are refilled as requested, or if empty bottles are missing. Ends script if there are no empty bottles left
160 if counttype serialofpotion backpack < amounttorestock and not findtype 'empty bottle%s%' backpack
161 overhead 'Not enough empty bottles' 33
162 break
163 endif
164endwhile
165overhead 'Script finished'
166########### END SCRIPT ###########