PDA

View Full Version : Script for making coffee



bremerial
08-23-2014, 05:57 PM
I've spent today playing with utility scripts. Not that I am any good at scripting but I just like a challenge and I had time on my hands today. Someone has very graciously agreed to look at another one I started. Anyhoo..

If anyone has time, could you tidy this one up and perhaps make it user friendly perhaps. It works - which is the main thing - but its ugly. I tend to use 10 commands when 1 would do, due to a lack of knowledge. I'd love this to be more Cinderella and less ugly sister!




Purpose of script: To make coffee using my own stove, press and kettle.

Issues for consideration:
1. I use tinder, log and water from Misty's Teas on Mist Harbor
2. My matches come from Teras and are retained, as sold, in an oil pouch
3. I use a twelve sided cup to drink from - hence the reference to 'twel cup'
4. I place my stove on a wyrom kit - just for visual effect amongst other things - but it could just as easily be stored on the ground.
5. I haven't worked out a way to retain the option to add cream, whiskey, syrup etc to the coffee within the script - so have ignored this and currently just add additional items manually.



# Making Coffee
# v.1 Script created by Bremerial God'thor

echo
echo You need to have your own stove, kettle, matches, coffee and coffee press
echo You can obtain the following from Misty's Teas on Mist Harbor: Water, log and tinder.
echo
echo Type 'slurp' if you want to make the best coffee ever, or escape key to get the items you need
echo

Mainloop:
match coffee1 slurp
match coffee2 You pour all of your pitcher of water into
match coffee3 and watch as it slowly catches fire
match coffee4 The water inside the cast iron kettle has reached a constant rolling boil
match coffee5 it is not time to push the plunger down just yet
match coffee6 marshalling the swirling coffee grounds to a prison underneath
match coffee7 that's likely a very bad idea
match coffee8 The faint glow within the cast iron stove flickers for a moment and goes out
match coffee9 You should clean out the ashes inside first
matchwait

coffee1:
put remove my kit
wait 1
put drop my kit
wait 2
put open keg
wait 2
put get stove
wait 2
put open my stove
wait 2
put clean my stove
wait 2
put put my stove on keg
wait 2
put take tinder
wait 2
put put tinder in stove
wait 2
put take my log
wait 2
put put my log in stove
wait 2
put get kettle
wait 2
put clean my kettle
wait 2
put get water from keg
wait 2
put pour my water in my kettle
goto mainloop

coffee2:
put put my kettle on stove
wait 2
put take oil pou
wait 2
put open oil pou
wait 2
put take match from oil pou
wait 2
put close oil pou
wait 2
put put oil pou in keg
wait 2
put light my match
wait 2
put light stove with my match
put drop my match
goto mainloop

coffee3:
put take jar from keg
wait 2
put open my jar
wait 2
put take ground
wait 2
put close my jar
wait 2
put put my jar in keg
wait 2
put take coffee press
wait 2
put clean my press
wait 2
put put my ground in my press
goto mainloop


coffee4:

put get kettle from stove
wait 2
put pour my kettle in my press
wait 2
put clean my kettle
wait 2
put put kettle in keg
wait 45
put push my press
goto mainloop

coffee5:
wait 30
put push my press
goto MainLoop


coffee6:
put get twel cup
put pour press in my cup
wait 2
put put press in keg
wait 2
put take stove
goto mainloop

coffee7:
wait 10
put get stove
goto mainloop

coffee8:
wait 60
put get stove
goto mainloop


coffee9:
wait 5
put clean stove
put get stove
put put my stove in keg
put close keg
put take keg
put wear my kit
echo
echo ******* Coffee is made *******
echo
echo
echo ******* just decide if you want to add anything to it like cream or whiskey *******
echo
exit

Tgo01
08-23-2014, 06:07 PM
Does it have to be a Wizard/Stormfront script? :p

bremerial
08-23-2014, 06:26 PM
I use stormfront, but if you want to play with something else I - or others - could use, go for it.
I wouldn't know where to begin with Lnet for example. But then Lnet is like my TV. I know if I pick up the remote and point it at the TV and press a button it comes on. I have no idea how though;I'm just happy it does.

What did you have in mind?

Tgo01
08-23-2014, 07:12 PM
A lich script :D



fput "remove my kit"
fput "drop my kit"
fput "open keg"
fput "get stove"
fput "open my stove"
fput "clean my stove"
fput "put my stove on keg"
fput "take tinder"
fput "put tinder in stove"
fput "take my log"
fput "put my log in stove"
fput "get kettle"
fput "clean my kettle"
fput "get water from keg"
fput "pour my water in my kettle"
waitfor "You pour all of your pitcher of water into"
waitrt?
fput "put my kettle on stove"
fput "take oil pou"
fput "open oil pou"
fput "take match from oil pou"
fput "close oil pou"
fput "put oil pou in keg"
fput "light my match"
fput "drop my match"
waitfor "and watch as it slowly catches fire"
waitrt?
fput "take jar from keg"
fput "open my jar"
fput "take ground"
fput "close my jar"
fput "put my jar in keg"
fput "take coffee press"
fput "clean my press"
fput "put my ground in my press"
waitfor "The water inside the cast iron kettle has reached a constant rolling boil"
waitrt?
fput "get kettle from stove"
fput "pour my kettle in my press"
fput "clean my kettle"
fput "put kettle in keg"
waitrt?

loop{
result = dothistimeout "push my press", 3, /it is not time to push the plunger down just yet|marshalling the swirling coffee grounds to a prison underneath/
if result =~ /it is not time to push the plunger down just yet/
sleep 30
elsif result =~ /marshalling the swirling coffee grounds to a prison underneath/
break
end
}

fput "get twel cup"
fput "pour press in my cup"
fput "put press in keg"
waitfor "The faint glow within the cast iron stove flickers for a moment and goes out"
sleep 60
waitrt?
fput "clean stove"
fput "get stove"
fput "put my stove in keg"
fput "close keg"
fput "wear my kit"
echo "******* Coffee is made *******"
echo "******* just decide if you want to add anything to it like cream or whiskey *******"


Note I don't have the materials to make coffee so I'm not sure if this is setup right but I think it is based on following along with what your script was doing.

bremerial
08-24-2014, 01:49 AM
Just woken up to a present! No , I haven't wet the bed! I mean your script! You know, the beauty of seeing someone put something together like this, is that it gives me a little better understanding of Lich. Will upload and test it as soon as I've rubbed the sleep from my eyes.

Thanks so much. Will confirm how I get on.

bremerial
08-24-2014, 03:17 AM
Yeah baby yeah! Just a few tweaks and it worked. Have tried it three times now and made some lovely coffee!! The only thing I need to remember is:

1. To check I have all the elements before I start - tinder, water, log, coffee, cup, stove, kettle, press
2. To keep at least one hand free for cleaning the stove near the end.
3. Ive added a look command at the end - only because I am nervous about leaving anything on the ground by accident that I might value. Haven't tested it but can I assume that fput "look" would work?

The 60 second wait from the light on the stove going out to cleaning it is timed to perfection.

Thanks so much



fput "remove my kit"
fput "drop my kit"
fput "open keg"
fput "get stove"
fput "open my stove"
fput "clean my stove"
fput "put my stove on keg"
fput "take tinder"
fput "put tinder in stove"
fput "take my log"
fput "put my log in stove"
fput "get kettle"
fput "clean my kettle"
fput "get water from keg"
fput "pour my water in my kettle"
waitfor "You pour all of your pitcher of water into"
waitrt?
fput "put my kettle on stove"
fput "take oil pou"
fput "open oil pou"
fput "take match from oil pou"
fput "close oil pou"
fput "put oil pou in keg"
fput "light my match"
fput "light stove with match"
fput "drop my match" <----------------------Not needed apparently. Match vanishes when stove is lit
waitfor "and watch as it slowly catches fire"
waitrt?
fput "take jar from keg"
fput "open my jar"
fput "take ground"
fput "close my jar"
fput "put my jar in keg"
fput "take coffee press"
fput "clean my press"
fput "put my ground in my press"
waitfor "The water inside the cast iron kettle has reached a constant rolling boil"
waitrt?
fput "get kettle from stove"
fput "pour my kettle in my press"
fput "clean my kettle"
fput "put kettle in keg"
waitrt?

loop{
result = dothistimeout "push my press", 3, /it is not time to push the plunger down just yet|marshalling the swirling coffee grounds to a prison underneath/
if result =~ /it is not time to push the plunger down just yet/
sleep 30
elsif result =~ /marshalling the swirling coffee grounds to a prison underneath/
break
end
}

fput "get twel cup"
fput "pour press in my cup"
fput "put press in keg"
waitfor "The faint glow within the cast iron stove flickers for a moment and goes out"
sleep 60
waitrt?
fput "clean stove"
fput "get stove"
fput "put my stove in keg"
fput "close keg"
fput "get keg"
fput "wear my kit"
fput "look"
echo "******* Coffee is made *******"
echo "******* just decide if you want to add anything to it like cream or whiskey *******"

Tgo01
08-24-2014, 04:07 PM
Woot!

Should be simple enough to add the features you wanted like adding cream or whiskey.