creatures caves
welcome, guest 

downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
 
Development Forum
old
No Fruits, just Plants..   1 | 2
Luzze

Luzze
Germany  


  7/31/2014

Well well, as many might know by now I'm working on a plant :P
There are many things perfectly working by now like the vendor and the seeds..
But there's something wrong with the plant and I can't figure out what.

So here's the theory:

The plants grow until they flower which creates a new flower object (that will be blank in the final but is now a red dot on the flower image).
If it's not pollinated the plant will decay (flower decay + die) after 20x 50 ticks
If it's pollinated the actual flower object will be ereased, the flower image will decay its flower and create a fruit. After the fruit is ripe and has fallen off the plant will die.

The fruite ripens when the lightlevel gets higher than when the seed sprouted.

What does the agent actually do?

It flowers up (no problem with the growing here!)
It can get pollinated (the flower object red dot vanishes when pollinating insects touch it)
It decays and dies. No fruit. And I can't find out why it's doing this! :(


I'll post the code starting with the plant timer script. Everything before that works just fine. Beware btw.. it's my first agent ^^"


*PLANT life
scrp 2 4 18903 9
setv ov09 0
gsub grow
*waits 1000 in bloom for pollination
setv va01 1000
loop
doif ov09 = 1
wait rand 20 100
gsub flowerdecay
gsub fruit
gsub die
else
wait 50
subv va01 50
endi
untl va01 = 0
*dies if not pollinated
doif ov09 = 0
gsub flowerdecay
gsub die
endi

*grow until Flower
subr grow
setv va00 pose
reps 7
wait ov04
addv va00 1
pose va00
repe
setv va03 posl
setv va04 post
addv va03 37
addv va04 42
*******Create FLOWER 18906**********
inst
new: simp 2 7 18906 "shinyflower" 1 33 6001
attr 16
bhvr 0
emit 9 .25
doif tmvt va03 va04 = 0
mvsf va03 va04
else
mvto va03 va04
endi
tick 1
targ ownr
retn

*decay the Flowerimage

subr flowerdecay
setv va00 pose
reps 6
wait rand 20 100
addv va00 1
pose va00
repe
retn

*make the fruit emerge
subr fruit
setv va00 pose
reps 3
wait rand 20 100
addv va00 1
pose va00
repe
setv ov05 posl
setv ov06 post
addv ov05 17
addv ov06 27
*******Create FRUIT 18903**********
inst
new: simp 2 7 18904 "shinyflower" 1 29 rand 200 6000
*invisible yet
attr 16
bhvr 0
*move into world
doif tmvt ov05 ov06 = 0
mvsf ov05 ov06
else
mvto ov05 ov06
endi
tick 10
targ ownr
loop
wait 50
untl ov07 = 1
retn

*lets the plant die
subr die
targ ownr
*doif va02 = 1
* subv va00 13
*else
subv va00 10
*endi
pose va00
wait 50
subv va00 1
pose va00
wait 50
subv va00 1
pose va00
wait 20
kill ownr
retn

endm

*Pollinate
scrp 2 7 18906 303
setv ov09 1
endm

*Flower dies
scrp 2 7 18906 9
setv va00 1000
loop
doif ov09 = 1
kill targ
else
wait 50
subv va00 50
endi
untl va00 = 0
endm

*fruit drop with lightlevel
scrp 2 7 18904 9
*light level
setv va00 grap posx posy
setv va01 prop va00 1
doif va01 > ov08
new: simp 2 8 18905 "shinyflower" 4 29 rand 200 6000
attr 195
bhvr 48
elas 30
accg 5
fric 100
emit 6 .25
doif tmvt ov05 ov06 = 0
mvsf ov05 ov06
else
mvto ov05 ov06
endi
kill ownr
frat 2
anim [0 1 2 3 2 1 3]
done
setv ov07 1
else
tick 10
endi
endm

*eat Fruit
scrp 2 8 18905 12
snde "chwp"
stim writ from 78 1
kill ownr
*making new seeds goes in here
endm

*Fruit collision
scrp 2 8 18905 6
sndc "dr10"
endm

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  7/31/2014

Do you have autokill on? Try removing the agent, turning off autokill, and then reinjecting the agent and reporting any error messages you get.

My TCR Norns
 
Luzze

Luzze
Germany  


  8/1/2014

Autokill was disabled, I don't get any errors. I just coded something wrong in the plant so it doesn't go into the fruiting part but dies off :( And I can't find out whats wrong!
 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/1/2014

Well, that in itself means that everything is working as you've told it to - so it might be a case of looking harder at how the plant is put together.

My TCR Norns
 
Luzze

Luzze
Germany  


  8/2/2014

I know that. It's some kind of logical error that I build in but can't figure out.
I'm completely new to caos, as I said this is my first agent. Maybe some things doesn't work the way I think they do?
I know that the ov that indicates pollination gets set to 1 if done so, so the problem is probably in the first timerscript loop in the plant - but everytime I read through it I can't find the point where it goes into the dying script when it's not intended :(
Do I have the wrong "targ" somewhere? Did I miss an inst where there should have been one?

 
Nutter
Senior Wrangler

Nutter
United Kingdom  


  8/2/2014

Fruit ripening is dependent on light level, you say - but that's a daily rather than seasonal thing, isn't it? Could that be causing a problem?
 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/2/2014

I'm not actually sure that the light levels change from day to night in the starship...

My TCR Norns
 
Luzze

Luzze
Germany  


  8/2/2014

Before anything with light comes into action the fertilized plant should grow a unripe fruit (going through 3 poses) before creating the new fruit agent that actually reacts to light. But it doesn't do so. It just decays as if it has never been pollinated.

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/2/2014

Could the bees be pollinating the flowers twice? As you set the pollination object variable to 0 at the beginning of the script, could it just be that as quickly as the bees work to pollinate your plant, your timer script works more quickly (what's the plant's TICK?) to undo that pollination?

My TCR Norns
 
Luzze

Luzze
Germany  


  8/2/2014

That could possibly be happening!
I will try it out tomorrow evening when I get back to my pc with the game on it.
Thanks for the tip :)

I think the tick for the flower with the script is 1 and for the plant it's some random number between 50 and 1150..

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/2/2014

Definitely try setting the pollination ov as 0 when you install the plant, not in the timer script. :)

My TCR Norns
 
Luzze

Luzze
Germany  


  8/4/2014

It didn't work :( My guess is that the change in the ov doesn't get recognised by the loop..
looking at other plants from the c3 commented bootstrap folder is confusing me big times.. they use *so* many different va's and ov's .. and no loops at all.. *sigh*

Edit: I just took out the loop and it worked o_O Sooo the timer script repeats by itself?

Edit2: Nop, didn't work. It just goes through the growing script again..

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/4/2014

The other thing that might be worthwhile is taking some things out of the subroutines and seeing how that changes the flow of things and how you visualise the plant. Could you please repost the code as it is now?

My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/4/2014

Yes, timer scripts repeat by themselves. TICK indicates how many ticks (1 tick is about 1/20th of a second) go by before the timer repeats by itself. Unless TICK is set differently somewhere in the script, the timer will continue to repeat at that interval.

When other scripts run it also interrupts the timer, forcing it to start fresh--it will reset prematurely instead of waiting for the timer, even if it hasn't reached the end of the script yet. So the fact that you set your pollination variable to 0 on the first line in the timer means that it is being set to zero EVERY time the script runs... meaning it is also being reset after every interruption... including pollination.

Typically, in most circumstances you'd use the whole timer script as your loop; that's pretty much what they're for. Setting initial variables is better to do when you create the agent, unless you need to change them later; although TBH, you don't really need to set something to be zero automatically, since that is any variable's default value.



 
Luzze

Luzze
Germany  


  8/4/2014

I didn't know if the variables would be zero from the start so I set it, remebering my C++ course :D But I took it out now anyways.

I set the timer script to be the loop now (With Tick 100 for a start). Build in a check if the growth has already be run but the script seemed to ignore it o_O (makes no sense at all!)

So the pollination script interfers the timerscript? That's bad :/

Can I prevent that somehow? Inst probably wont work with all the waits I put into the pose changes. What about Lock?

I tested that btw - now the plants grow and get pollinated and are stuck in this stage forever.

I'm trying to put the growth script somewhere else now, maybe that will get me at least a step closer..

The code so far:

[... uninteresting code ...]
*******Create PLANT 18903**********
inst
new: simp 2 4 18903 "shinyflower" 17 12 rand 200 6000
attr 16
rnge 200
perm 40
bhvr 192
emit 9 .1
doif tmvt va03 va04 = 0
mvsf va03 va04
else
mvto va03 va04
endi
setv ov10 rand 20 100
setv ov04 rand 150 400
tick 100
kill ownr
retn
endm

*PLANT life
scrp 2 4 18903 9
lock
*did it already grow?
doif va05 <> 1
gsub grow
endi
*is it fertilized?
doif ov09 = 1
wait ov10
gsub flowerdecay
gsub fruit
gsub die
*dies if grown and not pollinated in 1000 ticks
elif va05 = 1 and va01 = 0 and ov09 = 0
gsub flowerdecay
gsub die
else
wait 50
subv va01 50
endi
unlk
*grow until Flower
subr grow
setv va00 pose
reps 7
wait ov04
addv va00 1
pose va00
repe
setv va05 1
setv va01 1000
setv va03 posl
setv va04 post
addv va03 37
addv va04 42
*******Create FLOWER 18906**********
inst
new: simp 2 7 18906 "shinyflower" 1 33 6001
attr 16
bhvr 0
emit 9 .25
doif tmvt va03 va04 = 0
mvsf va03 va04
else
mvto va03 va04
endi
tick 1
targ ownr
retn

*decay the Flowerimage

subr flowerdecay
setv va00 pose
reps 6
wait rand 20 100
addv va00 1
pose va00
repe
retn

*make the fruit emerge
subr fruit
setv va00 pose
reps 3
wait rand 20 100
addv va00 1
pose va00
repe
setv ov05 posl
setv ov06 post
addv ov05 17
addv ov06 27
*******Create FRUIT 18903**********
inst
new: simp 2 7 18904 "shinyflower" 1 29 rand 200 6000
*invisible yet
attr 16
bhvr 0
*move into world
doif tmvt ov05 ov06 = 0
mvsf ov05 ov06
else
mvto ov05 ov06
endi
tick 10
targ ownr
loop
wait 50
untl ov07 = 1
retn

*lets the plant die
subr die
targ ownr
*doif va02 = 1
* subv va00 13
*else
subv va00 10
*endi
pose va00
wait 50
subv va00 1
pose va00
wait 50
subv va00 1
pose va00
wait 20
kill ownr
retn

endm


*Pollinate
scrp 2 7 18906 303
setv ov09 1
endm

*Flower dies
scrp 2 7 18906 9
setv va00 1000
loop
doif ov09 = 1
wait ov10
kill targ
else
wait 50
subv va00 50
endi
untl va00 = 0
endm

[... more uninteresting code stuff...]


What it does right now: Grow and go through the growing script *again* :( (until it errors out because it runs out of poses)

 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/4/2014

LOCK is only really good for small blocks; you don't really want to LOCK an entire block unless you really have to. It's a lot more code-friendly if you can make it so that your script can pick up where it left off. (You can read a bit more about why here, mostly the third paragraph.)

It might help if you use an OV variable to see if your plant has grown already. OVxx type variables are "permanent" in the sense that they exist as long as the agent does, but VAxx types are "temporary": they don't exist after the script that set them has run it's course, and won't "transfer" from one script to another the way OVxx types do. So checking for a VAxx type at the beginning of a script, it will always have a value of zero because its previous value has already been wiped.



 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/4/2014

You might also want to get rid of the retn in your plant installation script - as retn only closes a subr block.

inst
new: simp 2 4 18903 "shinyflower" 17 12 rand 200 6000
attr 16
rnge 200
perm 40
bhvr 192
emit 9 .1
doif tmvt va03 va04 = 0
mvsf va03 va04
else
mvto va03 va04
endi
setv ov10 rand 20 100
setv ov04 rand 150 400
tick 100
kill ownr
retn
endm


My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/5/2014

...I had assumed that was the tail end of a longer block, since plain old install scripts don't need ENDM, either.


 
Luzze

Luzze
Germany  


  8/5/2014

Yes, it is the end of the seed timer script and as it works perfectly I thought that posting it in whole would just be unnecessary stuff to read :)
Thanks for the link, Ghosthande. I read it and will try to restructure the code with OV checks. I didn't knew that Va's are reset when the timer script restarts.

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/5/2014

Oops, guess I didn't read the first bit too carefully. [nblush] I find it's always worthwhile to add in a comment saying what an OV is for when I first set it. :)

My TCR Norns
 
Luzze

Luzze
Germany  


  8/5/2014

Recoded and new/old problems :(
What works now is: Growing and dieing if not pollinated, decaying the flower in any case.

What doesn't work: Recognising the pollination, still!
The ov09 gets definitly set to 1. The Flower agent reacts to it and kills itself when set to 1. But still the plant runs through its script as if nothing happened.
If I set the ov to 1 manually (via caos console) it gets into the fruiting process.
But how can the ov not reach the plant?! It *is* set to 1 in the flower! Grml..

Another thing that happens now, when going through the fruit script is.. that it actually doesn't got though it or doesn't to anything. At first I had some pose changes in it and they got looped for I don't know what reason (it was set to lock) and no new fruit agent was created. I moved the pose changes to the flower decay and it works fine, but the fruit creation still doesn't happen. Even the ov change after it does not.


*-----------------------
*Variables used
*OV00: Plant Life OV06: Fruit post
*OV01: Vendor posx OV07: FREE
*OV02: Vendor post OV08: Light level while sprouting
*OV03: R_Seed decay timer/ tick OV09: Pollination
*OV04: R_Plant growth timer/ wait OV10: R_Plant/Flower synchronizer/ wair
*OV05: Fruit posx OV11: FREE
*-----------------------
...(here goes the code for the vendor and seed)...
*----------------------------------------------------------------------------------------
*ov00 indicates
*0 = new plant 2 = Flower decayed and pollinated 4= Flower decayed unpollinated
*1 = grown, flowering 3 = Stops infinite fruiting 5= death fruited
*----------------------------------------------------------------------------------------
*PLANT life
scrp 2 4 18903 9
*I wonder if it will work this time..
doif ov00 = 0
gsub grow
endi
doif ov00 = 1 and ov09 = 0
addv ov07 50
endi
doif ov00 = 1 and ov09 = 1
gsub flowerdecay
endi
doif ov00 = 2
gsub fruit
endi
doif ov00 >= 4
gsub die
endi
doif ov00 = 1 and ov07 = 5000
gsub flowerdecay
endi
*----------------------------------------------------------------------------------------

*grow until Flower
subr grow
lock
setv va00 pose
reps 7
wait ov04
addv va00 1
pose va00
repe
setv ov00 1
setv va03 posl
setv va04 post
addv va03 37
addv va04 42
unlk
*******Create FLOWER 18906**********
inst
new: simp 2 7 18906 "shinyflower" 1 33 6001
attr 16
bhvr 0
emit 9 .25
doif tmvt va03 va04 = 0
mvsf va03 va04
else
mvto va03 va04
endi
slow
tick 20
targ ownr
retn

*decay the Flowerimage

subr flowerdecay
lock
doif ov09 = 1
setv va01 9
else
setv va01 6
endi
setv va00 pose
reps va01
wait rand 20 100
addv va00 1
pose va00
repe
doif ov09 = 1
setv ov00 2
else
setv ov00 4
endi
unlk
retn

*make the fruit emerge
subr fruit
inst
setv ov05 posl
setv ov06 post
addv ov05 17
addv ov06 27
setv ov00 3
*******Create FRUIT 18903**********
new: simp 2 7 18904 "shinyflower" 1 29 rand 200 6000
attr 16
bhvr 0
*move into world
doif tmvt ov05 ov06 = 0
mvsf ov05 ov06
else
mvto ov05 ov06
endi
setv ov00 5
slow
tick 20
targ ownr
retn

*lets the plant die
subr die
lock
targ ownr
setv va00 pose
doif ov00 = 5
subv va00 13
else
subv va00 10
endi
pose va00
wait 50
subv va00 1
pose va00
wait 50
subv va00 1
pose va00
wait 20
kill ownr
unlk
retn

endm


*Pollinate
scrp 2 7 18906 303
setv ov09 1
endm

*Flower dies
scrp 2 7 18906 9
doif ov09 = 1 or ov00 >= 4
wait ov10
kill targ
endi
endm

*fruit drop with lightlevel
scrp 2 7 18904 9
*light level
setv va00 grap posx posy
setv va01 prop va00 1
doif va01 > ov08
inst
new: simp 2 8 18905 "shinyflower" 4 29 rand 200 6000
attr 195
bhvr 48
elas 30
accg 5
fric 100
emit 6 .25
doif tmvt ov05 ov06 = 0
mvsf ov05 ov06
else
mvto ov05 ov06
endi
kill ownr
frat 2
anim [0 1 2 3 2 1 3]
done
slow
endi
endm

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/5/2014

Have you tried letting the fruiting process be handled by the flower timer script (2 7 18906 9), instead of the plant timer script?

My TCR Norns
 
Luzze

Luzze
Germany  


  8/5/2014

sure.. thats actually a great idea! o:
I'll try that.
But the flowerscript would have to change the plant sprites.. how do I "targ" them?
In critter - interacting scripts it seems to work with "seta" but I don't really get it.

so "seta ov07 null" (as it is always used with null in the scripts I read) will store the targ agent information? or would it have to be "seta ov07 targ"?

Anyways, I can't targ from the flower to the plant with either..

 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/5/2014

NULL just makes it equal to nothing. Because you do want to give a variable an initial value if it's not going to be numeric type.

SETA sets a variable as a reference to another agent. So in the part of the plant's script that creates the flower, you could "SETA OVxx OWNR" and it would make that variable a reference to the owner of the script (the plant).

Then when you needed the flower to target the plant, you could just "TARG OVxx". And then "TARG OWNR" afterward, when you're ready to re-target the flower. :)



 
Luzze

Luzze
Germany  


  8/5/2014

I set a "SETA OV07 OWNR" at the beginning of the growth script now but every time the flower wants to targ the plant I get an error.. (says something like: agent expected) :(
 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/5/2014

At the beginning of the growth script? It sounds like you might be setting that variable for the plant, then, not the flower.

To set it on the flower itself, put that line in the part of the growth script where the flower is being created, right about where it sets the flower's ATTR, BHVR, etc... because the script's "attention" is on the flower at that point.



 
Luzze

Luzze
Germany  


  8/6/2014

But won't I want it to be on the plant?

I need to adress the plant from the flower timerscript to change poses in the plant not the flower from the plant timerscript.. even if I set it wrong, wouldn't it be only targing itself then instead of giving me an error?

 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/6/2014

No. If you set it at the beginning of the script then you already are setting it on the plant; that's why you're getting the error, it was never set for the flower but for the plant. So the flower thinks its value is still the default zero.

The error is essentially saying "Umm, I was expecting an agent here or at least NULL, but all I got was a number."

You need to set it when the flower is created so that it saves to the flower, so that the flower can use it in the future; if we save it to the plant then the flower won't have it.

OWNR is always the owner of the script: even though you are creating the flower in the plant's script, that is still inside a SCRP belonging to the plant. So even though the flower is "selected" while it is being created and variables will save to it, OWNR will always be the owner of the script (the plant).



 
Luzze

Luzze
Germany  


  8/6/2014  1

Ohh, I got it wrong then, sorry ^^"

It works now, btw :) Thanks for all the help!

 
Ghosthande
Prodigal Sock

Ghosthande
United States  

 visit Ghosthande's website: Breeders Beware
  8/6/2014

Yay! Glad you're having success. :)


 
Luzze

Luzze
Germany  


  8/10/2014

I finished the agent today <3

Many thanks for all the help and patience with me!

But there are still a questions.
The seeds of the plant classify as 'bad fruit' and have a eating script but I just can't get any norn to eat them to test what I have build there. Is there any way to force a norn to eat it? Talking to them doesn't help :P

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/10/2014

Can you double-check that they have a BHVR that allows them to pick up the 'bad fruit' and eat it? You can find a calculator for this at CAOS APPS.

My TCR Norns
 
Luzze

Luzze
Germany  


  8/11/2014

Yes, they pick them up all the time and run around with them when I tell them to eat them :D
One time one even ate one by chance (so the bhvr is set right!) but it gave me an error because I forgot to set the targ right. That's why I would like to test it again now, after I changed it..

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/11/2014

Are you playing with wolfling norns? Sometimes it can be helpful to test these things with hand-reared norns, because they know what the hand is, and know that if they trust the hand and try something new, they get a tickle, and if they disobey the hand, they get a slap.

My TCR Norns
 
Luzze

Luzze
Germany  


  8/11/2014

Yup, I played with wolfling norns, but that wasn't the problem..
I raised up a single nornbaby in a new world and taught and told her many things and she listened perfectly just not to the 'eat' command..
I found out that I got a little confused with the german word(s) for 'eat' as it seems to differs between C2 and C3/DS :P After I got it right she enthusiastically ate all the poisonous seeds and died from belladonna :(
Now I feel bad.

 
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  8/11/2014

Have you considered adding stimulus 82 instead of belladonna? The Yule Booze, which is also a 'bad fruit' uses stimulus 82 and gets norns drunk.

My TCR Norns
 

prev | 1 | 2 | next

downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki