creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Finding RoomID after NEW: SIMP   
Geek2Nurse

Geek2Nurse
United States  

 visit Geek2Nurse's website: Adventures in Nornia
  5/27/2012

So I have a seed timer script which creates a plant using NEW: SIMP and after it's created, in the creation script (10), I want to get its room ID. My understanding is that TARG is set to the newly created agent after a NEW: SIMP command, right? (I'm not passing any values to the creation script; just letting it run automatically after the NEW: SIMP command.)

I've tried

setv va20 room targ

and
setv va20 room ownr

and
setv va20 grap posx posy


The initial plant script when the plants are first injected uses the same creation script, and any of the three commands gives me a valid room ID. But when its run after the NEW: SIMP in the seed timer script, all three return -1.

My understanding is that the seed starts out as OWNR and TARG of the seed script, but then when the new plant is created, OWNR is the seed and TARG is the plant. But when the plant creation script is called, both OWNR and TARG should be the new plant, shouldn't they?


---
Optimist: the glass is half full.
Pessimist: the glass is half empty.
Engineer: the glass is twice as big as it needs to be.

 
Moe

Moe


 visit Moe's website: Creatures 2 to Docking Station
  5/27/2012

You new: simp an agent, then you move it to a location, probably with mvsf or mvto, correct? The problem is that the creation script occurs immediately following the new: simp, and it evaluates faster than the time it takes to go from new: simp, to mvsf or mvto. So your agent, at the time the constructor script (10) runs, is no-where, or at coordinates 0 0. Try adding a "wait 1" or a marginally larger wait at the start of the constructor script, and see if that helps. :) This should allow time for the agent to be moved before it returns the rtyp in the constructor.

It looks like this:
new: simp X X X etc etc...
[constructor script]
mvst/mvsf X X

So the constructor script is returning coordinates before it's actually been moved. At least, I think this is what's happening. I know I've dealt with this problem before, where the constructor runs before the agent is placed or valuable data is assigned to the agent.

 
Geek2Nurse

Geek2Nurse


 visit Geek2Nurse's website: Adventures in Nornia
  5/27/2012

Aha, that did it. Thanks, Moe! I understand a little better now... :)

I'm working on the next generation of starflower, which takes CA levels into account. It will still grow anywhere there's soil, because it seems sad for things just not to work because of inadequate CA levels. (And because of stupid stuff like the jungle being brighter and the desert being wetter than the aquarium...what's THAT about???)

So the rate of growth is based on availability of light, moisture, and nutrients. Each time thru the timer cycle, the flower checks levels of resources and recalculates TICK. Each flower deducts a tiny bit of each CA per tick cycle, but they also add some back when they die.

So anyway, if they can't figure out what room they're in on that first tick, I just set a default rate and let them figure it out the next time. It's working beautifully!

Now I'm trying to decide if I should also add in factors for whether the soil is boggy, normal, or drained, or just have faith that the CA settings will actually reflect those...I need to go back and review Amai's article again already!


---
Optimist: the glass is half full.
Pessimist: the glass is half empty.
Engineer: the glass is twice as big as it needs to be.

 


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
1 online
RisenAngel
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