I've been improving on my CAOS skills as of recently (I can now make plants easily). However, occasionally I have a little trouble.
First thing involves a critter I was trying to make, but it doesn't work right. It's a fish that does nothing other than swim, avoid obstacles, and be eaten by creatures. However, it doesn't exactly work right. When the following code is injected, all the fish does is go up, facing only one direction, or go either left or right, flipping directions erraticly.
Its code:
inst
reps rand 2 4
new: simp 2 20 18761 "dfish" 2 0 3500
attr 199
bhvr 48
accg 0
aero 2
elas 10
perm 50
setv ov00 0
tick 1
mvto 5376 2299
repe
endm
scrp 2 20 18761 9
gsub room
doif ov00 >= 10000
gsub deth
endi
doif ov99 = 1
gsub deth
endi
addv ov00 1
gsub obst
gsub swim
gsub move
subr deth
inst
doif carr = null and carr <> pntr
targ ownr
kill ownr
elif carr <> pntr
setv ov99 1
endi
retn
subr room
doif rtyp room ownr ne 8 and rtyp room ownr ne 9
loop
addv ov02 1
accg 5
untl rtyp room ownr = 8 or rtyp room ownr = 9 or ov02 = 100
doif ov02 >= 100
gsub deth
endi
endi
doif rtyp room ownr = 8 and rtyp room ownr = 9
setv ov02 0
endi
accg 0
retn
subr obst
doif obst rght < 100 and ov03 > 0
velo 0 0
setv ov03 -1
gsub golt
setv ov04 rand -6 -3
elif obst left < 100 and ov03 < 0
velo 0 0
setv ov03 1
gsub gort
setv ov04 rand 3 6
endi
doif obst _up_ < 200 and ov05 <= 0
velo 0 0
setv ov05 1
setv ov06 2
elif obst down < 200 and ov05 >= 0
velo 0 0
setv ov05 -1
setv ov06 -2
endi
retn
subr move
velo ov04 ov06
retn
subr gort
velo 1 0
pose 1
retn
subr golt
velo -1 0
pose 0
retn
subr swim
wait rand 1 7
doif ov03 < 0
pose 1
elif ov03 > 0
pose 0
endi
retn
endm
scrp 2 20 18761 12
snde "chwp"
stim writ from 80 1
kill ownr
endm
rscr
enum 2 20 18761
kill targ
next
scrx 2 20 18761 9
scrx 2 20 18761 12 |
When I tried asking for help on Gameware, all I got was this answer:
Cryptic answer wrote:
You forgot to rip the subroutine "drft".
What the heck is that supposed to mean?
Next thing: This code works right, but for some reason it prevents creatures from eating, pushing stuff, etc. Does anybody know why?
inst
new: simp 1 1 18763 "blnk" 1 0 6000
attr 16
tick 1
doif gnam = "Creatures 3"
mvto 906 678
elif gnam = "Docking Station"
mvto 450 9145
endi
endm
scrp 1 1 18763 9
inst
enum 4 0 0
doif chem 62 > .3
accg 0.3
elif chem 62 < .3
accg game "c3_creature_accg"
endi
next
endm
rscr
enum 4 0 0
accg game "c3_creature_accg"
next
enum 1 1 18763
kill targ
next
scrx 1 1 18763 9 |