The Mini Empathic Vendor has a script which, when the main empathic vendor has its hearing turned on, causes it to vend food in response to educated norns complaining about hunger, and causes the three food vendors in the norn meso (justanut, lemon and carrot pods) to vend food if the mini empathic vendor is not close enough.
The advantage of using the catalogue files in this way is that it will work for norns speaking English or any other language - as long as they are educated, the vendor will be able to hear them.
From "empathic vendor.cos", in the DS bootstrap:
** The Vendor's Ear
scrp 2 23 3 126
**this whole script will not fire unless ov00 is 1. The ear is set as 'on' by default, but it can be set as 'off' by clicking the relevant button on the main empathic vendor.
doif ov00 = 1
lock
sets va00 _p1_
seta va01 _p2_
inst
doif va01 <> null
targ ownr
rnge 1000
** Check to see if you can actually see the speaker, if not.. get one of the pods to make some food!
doif seee ownr va01 = 1
setv va99 1
endi
** Get the hunger sentences from the catalogues.
** Protein
**this sets va10 as being the first entry in the 'creature drives' catalogue that can be 'read' by the ear. This is 'hungry for protein'.
sets va10 read "Creature Drives" 1
** Starch
**this sets va11 as being the second entry in the 'creature drives' catalogue that can be 'read' by the ear. This is 'hungry for starch'.
sets va11 read "Creature Drives" 2
** Fat
**this sets va12 as being the first entry in the 'creature drives' catalogue that can be 'read' by the ear. This is 'hungry for fat'.
sets va12 read "Creature Drives" 3
** Check Sentence to see if it wants Fat (Food)
**do if the string-in-string search, in lower case, is nearby (va00) and has expressed a need for fat
doif sins lowa va00 1 lowa va12 <> -1
part 1
frat 2
anim [4 5 6 5 255]
snde "empv"
**if you're too far away
doif va99 = 0
** Tell the Carrot Pod to make a Carrot
inst
enum 2 23 4
doif targ <> null
mesg writ targ 0
endi
next
wait 15
targ ownr
part 1
frat 5
anim [1 2 3 2 255]
stop
**or if you're close
elif va99 = 1
** Tell yourself to vend Peaking Pie
mesg writ ownr 1003
stop
endi
endi
** Check Sentence to see if it wants Protein (Fruit)
doif sins lowa va00 1 lowa va10 <> -1
part 1
frat 2
anim [4 5 6 5 255]
doif va99 = 0
** Tell the Lemon Pod to make a Lemon
inst
enum 2 23 6
doif targ <> null
mesg writ targ 0
endi
next
wait 15
targ ownr
part 1
frat 5
anim [1 2 3 2 255]
stop
elif va99 = 1
** Tell yourself to vend Yarn Fruit
mesg writ ownr 1002
stop
endi
endi
** Check Sentence to see if it wants Starch (Seeds)
doif sins lowa va00 1 lowa va11 <> -1
part 1
frat 2
anim [4 5 6 5 255]
doif va99 = 0
** Tell the Nut Pod to make a Nut
inst
enum 2 23 5
doif targ <> null
mesg writ targ 0
endi
next
wait 15
targ ownr
part 1
frat 5
anim [1 2 3 2 255]
stop
elif va99 = 1
** Tell yourself to vend Star Seeds
mesg writ ownr 1001
stop
endi
endi
endi
endi
endm
No comments:
Post a Comment