Gnarler Water-Shyness Development Malkin | 5/26/2013
Looking at the code that keeps the Gnarler out of the Ettin Desert pond.
The following code is in the Gnarler timer script, which helps keep the Gnarler out of the Ettin Desert's pond by using the water CA. It isn't held in a subroutine, meaning that it is always active, or potentially active, upon smelling water.
|**keep away from bodies of water
*Do this if you're in a room.
doif room targ ne -1
*Do this if you smell any water at all.
doif prop room targ 5 ge 0.00001
*Look for the room next to this one that smells less like water.
setv va00 lorp room targ 5 0
*Go towards the centre of the room that smells less like water.
setv va01 torx va00
*If the less-smelly room is on your left and you were going right, turn around.
doif va01 lt 0 and ov10 gt 0
*or else, if the less-smelly room is on your right and you were going left, turn around.
elif va01 gt 0 and ov10 lt 0
*end the turning around doif
*end the 'smelling water' doif
*end the 'I'm in a room' doif
AquaShee's Crabs use a reversed version of this to help them seek out water sources.
I wonder, is it feasible to apply this to a creature?