Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Issue with the on_rez command

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-01-2005 22:30
this has given me headaches for the last 7 hours. I'm trying to create A-life and decided to use multiple scripts for each behaviour type; ex: script for idle movement, script for fleeing preadators, script for reproduction, script for seeking food. The use a different script for each behaviour works out very well in letting the behaviours "fight it out" depending on the situation to let the A-life decide what's going on.


***The problems I'm having***
Using multiple scripts has been a real issue in passing on gene information that is "mutated" (to allow for some evolution through the generations). in using the llRezObject to pass a randomly generated chat channel which is then passed to the "Baby" A-life using the on_rez command, I've found that even with using a short llSleep() command before passing the info on the appropriate channel the scripts in the "baby" will sometimes miss the message that's been sent. I think my problem is that I have the on_rez event for each script and each script sorts out the info, which may be causing a short delay in processing time to where one of the scripts that processes slower misses the message entirely.

is there another way around passing multiple pieces of information to multiple scripts in a single prim when it's rezzed? right now I'm experimenting with only one of the scripts recieving the information and then the other scripts have a listen call for the "baby's" unique key on a specified channel to sort out the information for themselves. with the way my A-life works using repeating sensors to determine behaviour based on the environment, I'd like to cut down on listeners as much as possible.
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
12-01-2005 23:20
Answering my own question:

I got a message ingame informing me that llMessageLinked() also works between scripts as well as between child prims. I was not aware of this, and llMessageLinked is working out great :) many thanks to Intent Unknown.
Luc Aubret
Oreo-eater
Join date: 14 Sep 2005
Posts: 86
12-01-2005 23:31
Well, apparently we were writing at the same time. Well, that was a waste, LOL.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
12-02-2005 08:15
Also, there's an object_rez event in the parent object that lets you know that the new object has been created. I put my sleep inside there, instead of putting it after the llRezObject call. That way you know the child object has actually been created, and you have a better chance that it'll have its listener up and running by the time you send out the chat message. If you're rezzing one object at a time, that might be something you could use.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
12-02-2005 12:55
What I did on my birds (which I set aside while I figure out more of the SL physics by throwing my avatar around instead) was have the control script in the bird send a message to the creator when it was rezzed and ready for a reply. That way I wasn't ever in a race condition between a timer and the lag.