Saturday 6 June 2015

Gnarler Water-Shyness

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.

**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
negv ov10
*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
negv ov10
*end the turning around doif
endi
*end the 'smelling water' doif
endi
*end the 'I'm in a room' doif
endi


AquaShee's Crabs use a reversed version of this to help them seek out water sources.

No comments:

Post a Comment