|
Development Forum |
 |
| 'New Carrots' Not Growing | |
|

Malkin
     Manager

|
7/14/2013 | |
So I found this 'newcarrots.cos' file on a HomeCreatures site. I'm trying out the object in my world, and the carrot seedling appears, but does not seem to grow at all, before eventually vanishing.
Can anyone tell me why this might be so?
inst
reps 10
new: simp 2 11 55500 "carr2" 9 0 500
attr 199
accg 5
aero 20
bhvr 48
elas 0
mvto rand 500 1200 500
setv ov61 60
setv ov20 30
setv ov15 -10
emit 8 0.5
perm 60
setv ov10 50
setv ov11 3000
tick 50
repe
endm
scrp 2 11 55500 9
doif pose lt 6
addv ov15 1
addv ov20 1
setv va67 totl 2 11 55500
doif va67 > 49
setv va68 rand 0 1
subv ov20 va68
endi
doif ov20 ge 30
doif pose lt 5
subv ov20 30
setv va00 pose
pose va00
else
setv va70 rand -1 1
setv va10 ov10
setv va11 ov11
addv va10 va70
mulv va70 25
addv va11 va70
setv va30 posx
setv va31 post
setv va73 rand -30 30
addv va30 va73
new: simp 2 11 55500 "carr2" 9 0 50
attr 199
accg 5
aero 20
bhvr 48
elas 0
mvto va30 va31
setv ov61 60
setv ov20 100
setv ov15 -10
emit 8 0.5
perm 60
setv ov10 va10
setv ov11 va11
tick va10
slow
endi
endi
doif ov15 ge ov11
pose 7
wait 500
altr
room targ 4 0.01
altr
room targ 3 0.01
kill ownr
endi
endi
endm
scrp 2 11 55500 12
stim writ from 79 1.5
snde "chwp"
kill ownr
setv va40 totl 2 11 55500
doif va40 lt 3
new: simp 2 11 55500 "carr2" 9 0 50
attr 199
accg 5
aero 20
bhvr 48
elas 0
mvto rand 500 1200 500
setv ov61 60
setv ov20 100
setv ov15 -10
emit 8 0.5
perm 60
setv ov10 50
setv ov11 3000
tick 50
slow
endi
endm |
My TCR Norns |

Malkin
     Manager

|
9/12/2013 | |
So, a little birdie tells me that it looks like the pose is never incremented up.
The lines that have been identified are:
which set va00 equal to the current pose, but does not increment it by one (allowing the carrot to grow) before setting pose to equal va00.
My TCR Norns |
 Mad Scientist
clohse
 

|
9/14/2013 | |
Did that help? Since I didn't have the matching image file I tried it with another carrot sprite and got a bounding box error when the pose changed. I'm hoping that doesn't happen when it uses the image it was meant to use.
CLohse's Norns at the Creatures Repository |

Malkin
     Manager

|
9/14/2013 | |
I think it uses the C2 carrot image. Incrementing the pose up by 1 did cause it to change poses once before autokilling.
Injecting it without autokill has proved interesting - the carrots seem to be visible, gettable and edible before they're ripe.. But solving the autokill should come first. 
According to this, bounding box errors only happen when the sprite file is of different sizes?
My TCR Norns |

Malkin
     Manager

|
11/5/2013 | |
I had another thought on this - could it cause errors when eaten, because the item is killed with kill ownr before it checks the population to see if another item should spawn?
My TCR Norns |
 Peppery One
Papriko
    
|
11/5/2013 | |
Guess so. AFAIK can a kill targ'd agent no longer execute scripts. Anything after kill ownr is basically ignored.
Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis... |

Malkin
     Manager

|
11/5/2013 | |
Thanks! 
So now I'm thinking that the problem is this part of the code here:
doif ov15 ge ov11
pose 7
wait 500
altr
room targ 4 0.01
altr
room targ 3 0.01
kill ownr
endi |
Which kills off the carrot by changing it from being a ripe, plump, carrot at pose 6 (width 48 and height 16) to being an upright, wilted carrot at pose 7 (width 16 and height 48). Does this sound like a plausible theory?
My TCR Norns |
 Mad Scientist
clohse
 

|
11/5/2013 | |
That does sound to me like a bounding box error.
CLohse's Norns at the Creatures Repository |

Malkin
     Manager

|
11/5/2013 | |
In the code, though, it comes far later than the autokill problem...
The initial sprout itself is far smaller than its compatriots - perhaps that is the problem?
For reference, the code is
inst
reps 10
new: simp 2 11 55500 "carr2" 9 0 500
*invisible, suffer collisions, suffer physics at this stage
attr 208
accg 5
aero 20
*pick up only at this stage
bhvr 32
elas 0
mvto rand 500 1200 500
setv ov61 60
setv ov20 30
setv ov15 -10
perm 60
setv ov10 50
setv ov11 3000
tick 50
repe
endm
scrp 2 11 55500 9
*If you're not mature and lying down
doif pose lt 6
*add 1 to ov15 and ov20
addv ov15 1
addv ov20 1
*check the overall population
setv va67 totl 2 11 55500
doif va67 > 49
setv va68 rand 0 1
subv ov20 va68
endi
*if the population is over 30
doif ov20 ge 30
*if you're still growing
doif pose lt 5
*subtract 30 from ov20
subv ov20 30
*make the carrot grow
setv va00 pose
addv va00 1
pose va00
*if your pose is 5
else
doif attr eq 208
attr 195
bhvr 48
emit 8 0.5
endi
setv va70 rand -1 1
setv va10 ov10
setv va11 ov11
addv va10 va70
mulv va70 25
addv va11 va70
setv va30 posx
setv va31 post
setv va73 rand -30 30
addv va30 va73
doif carr eq null
*make a new food item
new: simp 2 11 55500 "carr2" 9 0 50
attr 208
accg 5
aero 20
bhvr 32
elas 0
mvto va30 va31
setv ov61 60
setv ov20 100
setv ov15 -10
perm 60
setv ov10 va10
setv ov11 va11
tick va10
slow
endi
endi
endi
*If your life is over
doif ov15 ge ov11
doif attr eq 195
attr 208
emit 8 0.0
endi
doif pose eq 5
pose 7
elif pose eq 6
pose 8
endi
wait 500
altr
room targ 4 0.01
altr
room targ 3 0.01
kill ownr
endi
endi
endm
scrp 2 11 55500 12
stim writ from 79 1.5
snde "chwp"
setv va40 totl 2 11 55500
doif va40 le 3
new: simp 2 11 55500 "carr2" 9 0 50
attr 208
accg 5
aero 20
bhvr 32
elas 0
mvto rand 500 1200 500
setv ov61 60
setv ov20 100
setv ov15 -10
emit 8 0.5
perm 60
setv ov10 50
setv ov11 3000
tick 50
slow
endi
kill ownr
endm
*get script
scrp 2 11 55500 4
stim writ from 18 1
lock
doif pose eq 6
pose 5
elif pose eq 8
pose 7
endi
attr 195
accg 5
bhvr 48
emit 8 0.5
endm
*drop script
scrp 2 11 55500 6
stim writ from 19 1
doif pose eq 5
pose 6
elif pose eq 7
pose 8
endi
snde "dr10"
endm
*remove
rscr
enum 2 11 55500
kill targ
next
scrx 2 11 55500 9
scrx 2 11 55500 12
scrx 2 11 55500 4
scrx 2 11 55500 6 |
My TCR Norns |