Tuesday 17 January 2017

Fixed Turkey and Fixed Pudding

I hope everyone enjoyed the Creatures Community Spirit Festival 2016 - I know I did.  Congratulations to Allekha and Doringo for pulling it all together!

I thought I should post a CAOS walkthrough of the Fixed Christmas Pudding and Fixed Turkey (they are identical, bar the sprites and class numbers used) to demonstrate how they work.


First, the original script:
scrp 2 6 5 1
snde chwp 
stim writ from 10 255 0 0 35 250 34 10 57 150 0 0 
pose 1 
endm

Note how the pudding doesn't vanish from the world (using KILL) in the eat script here - this is accomplished by the drop script in the original, leading to a food item that only vanishes once it is dropped - not so good for learning!

The fixed editions have an additional feature that turns these from one-shot treats to easy-to-find emergency rations.

*Eat script for the pudding
scrp 2 6 5 1
*Make a noise
snde chwp
*stimulate the thing that made the script fire, jiggle its brain a little, and give it some nutrients
stim writ from 10 255 0 0 35 150 34 30 57 150 0 0
*strike a pose
pose 1
*WAIT for a second
wait 10
*If there's only one pudding in the world (the eaten pudding in the creatures' paws)...
doif totl 2 6 5 eq 1
*instantaneously
inst
*create a new pudding
new: simp holi 3 0 3500 0
*identical in class to the one before it
setv clas 33948928
*put it in the kitchen
mvto 2934 900
*same attributes
setv attr 67
*same behaviours
bhvr 0 1
*it says hello to the world, and is ready to eat
mesg writ targ 8
*end the if-there's-only-one-pudding check
endi
*the eaten pudding removes itself in its own eat script
kill ownr
*and the script ends
endm