Luscinia
09-22-2014, 02:08 PM
Someone asked me in-game how I convert recipes to StormFront scripts so I thought I would toss it up here.
I wanted to write these so that the scripts work on training cauldrons as well, where there's a chance of failure on each step, so there's a MATCH-loop each time to check if the step was successful; and I used LOOK instead of matching on success/failure messages since it works the same way for simmer/boil/infuse/etc. and I don't have to remember their specific messaging.
Here's what I use for every journeyman alchemist's favorite recipe, minor sneezing powder. (Run without arguments to see the recipe. The first argument should be the name of the cauldron, such as "cauldron", "boiler", "vat", or whatever you use. Optionally you can specify a second argument where the ingredients are stored, otherwise it defaults to "satchel".)
# Minor Sneezing Powder
# "a glass vial containing fine white powder"
IF_1 GOTO Setup
echo Minor sneezing powder
echo
echo Add water
echo Add powdered citrine quartz
echo Add essence of fire
echo Simmer
echo Add 3 doses of pepperthorn root
echo Add 2 doses of ayanad crystal
echo Boil
echo Add concentrated firethorn essence
echo Infuse mana
exit
Setup:
setvariable cauldron %1
IF_2 GOTO SetSource
setvariable source satchel
GOTO Start
SetSource:
setvariable source %2
Start:
put light %cauldron
waitfor A small flickering flame appears beneath it
put get water in my %source
waitfor You remove
put put water in %cauldron
put get citrine quartz in my %source
waitfor You remove
put put citrine quartz in %cauldron
put get fire in my %source
waitfor You remove
put put fire in %cauldron
Simmer:
put alchemy simmer
waitfor Roundtime
wait 1
MATCH Simmer essence of fire.
MATCH Simmered and simmered it.
put look %cauldron
MATCHWAIT
Simmered:
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get ayanad crystal in my %source
waitfor You remove
put put ayanad crystal in %cauldron
put get ayanad crystal in my %source
waitfor You remove
put put ayanad crystal in %cauldron
Boil:
put alchemy boil
waitfor Roundtime
wait 1
MATCH Boil ayanad crystal.
MATCH Boiled and boiled it.
put look %cauldron
MATCHWAIT
Boiled:
put get firethorn essence in my %source
waitfor You remove
put put firethorn essence in %cauldron
Infuse:
put alchemy infuse
waitfor Roundtime
wait 1
MATCH Infuse concentrated firethorn essence.
MATCH Infused and infused mana.
put look %cauldron
MATCHWAIT
Infused:
put alchemy seal
Also (if anyone with edit access to KP is reading), one of the listed formulas for minor stamina potions is slightly off. Instead of "water, 2 smooth stone, ground chestnut, essence of vitality, simmer", it should be "water, smooth stone, 3 powdered water chestnut, essence of vitality, simmer".
I wanted to write these so that the scripts work on training cauldrons as well, where there's a chance of failure on each step, so there's a MATCH-loop each time to check if the step was successful; and I used LOOK instead of matching on success/failure messages since it works the same way for simmer/boil/infuse/etc. and I don't have to remember their specific messaging.
Here's what I use for every journeyman alchemist's favorite recipe, minor sneezing powder. (Run without arguments to see the recipe. The first argument should be the name of the cauldron, such as "cauldron", "boiler", "vat", or whatever you use. Optionally you can specify a second argument where the ingredients are stored, otherwise it defaults to "satchel".)
# Minor Sneezing Powder
# "a glass vial containing fine white powder"
IF_1 GOTO Setup
echo Minor sneezing powder
echo
echo Add water
echo Add powdered citrine quartz
echo Add essence of fire
echo Simmer
echo Add 3 doses of pepperthorn root
echo Add 2 doses of ayanad crystal
echo Boil
echo Add concentrated firethorn essence
echo Infuse mana
exit
Setup:
setvariable cauldron %1
IF_2 GOTO SetSource
setvariable source satchel
GOTO Start
SetSource:
setvariable source %2
Start:
put light %cauldron
waitfor A small flickering flame appears beneath it
put get water in my %source
waitfor You remove
put put water in %cauldron
put get citrine quartz in my %source
waitfor You remove
put put citrine quartz in %cauldron
put get fire in my %source
waitfor You remove
put put fire in %cauldron
Simmer:
put alchemy simmer
waitfor Roundtime
wait 1
MATCH Simmer essence of fire.
MATCH Simmered and simmered it.
put look %cauldron
MATCHWAIT
Simmered:
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get pepperthorn root in my %source
waitfor You remove
put put pepperthorn root in %cauldron
put get ayanad crystal in my %source
waitfor You remove
put put ayanad crystal in %cauldron
put get ayanad crystal in my %source
waitfor You remove
put put ayanad crystal in %cauldron
Boil:
put alchemy boil
waitfor Roundtime
wait 1
MATCH Boil ayanad crystal.
MATCH Boiled and boiled it.
put look %cauldron
MATCHWAIT
Boiled:
put get firethorn essence in my %source
waitfor You remove
put put firethorn essence in %cauldron
Infuse:
put alchemy infuse
waitfor Roundtime
wait 1
MATCH Infuse concentrated firethorn essence.
MATCH Infused and infused mana.
put look %cauldron
MATCHWAIT
Infused:
put alchemy seal
Also (if anyone with edit access to KP is reading), one of the listed formulas for minor stamina potions is slightly off. Instead of "water, 2 smooth stone, ground chestnut, essence of vitality, simmer", it should be "water, smooth stone, 3 powdered water chestnut, essence of vitality, simmer".