Skip to content
Outlands Hub

Razor script

Fill potions from kegs

by Nevor · 172 lines
Download

MANUAL INPUT ########## Please set the amount of pots # you want to fill down below # Empty bottles have to be prov- # ided manually # Heal/Yellow potions

Healing
Fill potions from kegs.razor
1# This is an automated backup - check out https://outlands.uorazorscripts.com/script/4f88f5d2-763f-4a2a-8b05-9b2d9d691fed for latest2# Automation by Jaseowns3## Script: Fill potions from kegs4## Created by: Nevor#90515#############################################6 7########## MANUAL INPUT ##########8# Please set the amount of pots  #9# you want to fill down below    #10# Empty bottles have to be prov- #11# ided manually                  #12##################################13#Heal/Yellow potions14@setvar! healpots 1015#Orange/Cure potions16@setvar! curepots 1017#Red/Stamina potions18@setvar! redpots 1019#White/Strength potions20@setvar! whitepots 021#Blue/Agility potions22@setvar! bluepots 023#Black/Resist Magic potions24@setvar! blackpots 025#Purple/Explosive potions26@setvar! purplepots 027#Green/Poison potions28@setvar! greenpots 029 30# The script will first check your backpack for kegs, then the ground.31# If there are no kegs found you can define a specific container via target cursor.32# That specific container is stored as a persistent variable.33# If you want to use the bank box directly, without using a separate container inside, targeting yourself seems to work (no idea why)34 35########## START SCRIPT ##########36# NO CHANGES NEEDED FROM HERE ON #37##################################38overhead 'Filling potions from kegs'39 40//counts up to cycle through potion types41@setvar! myrestockcounter 042//short global wait-time variable in ms43@setvar! alittlebit 5044//long global wait-time variable in ms45@setvar! abit 25046 47//Main loop through the different potion types as long as we have empty bottles48while myrestockcounter < 8 and findtype 'empty bottle%s%' backpack49    if myrestockcounter = 050        //Yellow potions51        @setvar! serialofpotion 385252        @setvar! colorofkeg 25353        @setvar! amounttorestock healpots54        @setvar! myrestockcounter 155    elseif myrestockcounter = 156        //Orange potions57        @setvar! serialofpotion 384758        @setvar! colorofkeg 4459        @setvar! amounttorestock curepots60        @setvar! myrestockcounter 261    elseif myrestockcounter = 262        //Red potions63        @setvar! serialofpotion 385164        @setvar! colorofkeg 3765        @setvar! amounttorestock redpots66        @setvar! myrestockcounter 367    elseif myrestockcounter = 368        //White potions69        @setvar! serialofpotion 384970        @setvar! colorofkeg 95671        @setvar! amounttorestock whitepots72        @setvar! myrestockcounter 473    elseif myrestockcounter = 474        //Blue potions75        @setvar! serialofpotion 384876        @setvar! colorofkeg 9377        @setvar! amounttorestock bluepots78        @setvar! myrestockcounter 579    elseif myrestockcounter = 580        //Black potions81        @setvar! serialofpotion 384682        @setvar! colorofkeg 110983        @setvar! amounttorestock blackpots84        @setvar! myrestockcounter 685    elseif myrestockcounter = 686        //Purple potions87        @setvar! serialofpotion 385388        @setvar! colorofkeg 41989        @setvar! amounttorestock purplepots90        @setvar! myrestockcounter 791    elseif myrestockcounter = 792        //Green potions93        @setvar! serialofpotion 385094        @setvar! colorofkeg 36395        @setvar! amounttorestock greenpots96        @setvar! myrestockcounter 897    endif98    //loop that looks for kegs and fills up the pots99    while counttype serialofpotion backpack < amounttorestock 100        //as long as we have bottles101        if not findtype 'empty bottle%s%' backpack102            break103        endif104        //check our backpack for kegs105        if findtype 'keg' backpack colorofkeg as myKeg106            dclick myKeg107            while queued108                wait alittlebit109            endwhile        110        //check the ground for kegs111        elseif findtype 'keg' ground colorofkeg -1 2 as myKeg112            dclick myKeg113            while queued114                wait alittlebit115            endwhile116        //check if a container is already specified117        elseif varexist KegContainer and findtype 'keg' KegContainer colorofkeg as myKeg118            dclick myKeg119            while queued120                wait alittlebit121            endwhile122        else123            //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 up124            overhead 'Select container holding your kegs' colorofkeg125            @setvar KegContainer126            wait abit127            while targetexists128                wait abit129            endwhile130            //check if user selected a valid container, 131            if varexist KegContainer 132                dclick KegContainer133                wait abit134                //with kegs of the required potion type inside of it135                if findtype 'keg' KegContainer colorofkeg as myKeg136                    dclick myKeg137                    while queued138                        wait alittlebit139                    endwhile                    140                //no keg, no juice141                else142                   overhead 'No keg found' colorofkeg143                   //switch to the next potion type144                   break145                endif146            //Esc pressed147            else148                overhead 'Ending script - goodbye'149                stop150            endif151        endif152        if insysmsg 'You pour some'153            //juice is flowing,154            overhead 'Pouring...' colorofkeg155            clearsysmsg156        elseif insysmsg 'You must wait'157            //maybe even a little bit too fast sometimes, all good158            overhead 'Waiting...' colorofkeg159            clearsysmsg160        else161            //fail, maybe KegContainer variable is broken, needs to be manually reset during next cycle162            unsetvar KegContainer163        endif164    endwhile165    //Check if potions are refilled as requested, or if empty bottles are missing. Ends script if there are no empty bottles left166    if counttype serialofpotion backpack < amounttorestock and not findtype 'empty bottle%s%' backpack167        overhead 'Not enough empty bottles' 33168        break169    endif170endwhile171overhead 'Script finished'172########### END SCRIPT ###########