|
Carleb Callahan
Vive le tout!
Join date: 9 Jul 2004
Posts: 18
|
04-22-2006 10:04
I need to use several scripts on a single object, all meant to be interchangeable, etc. and to confine to procedure. I need to use intra-script communication otherwise this will not work. I'm just going to throw out a bunch of questions, and hopefully someone can direct me to a forum or and them in this thread.
1) Can scripts send messages back and forth? Alternatively, can they use or modify a set of global variables.
2) In the same thread, can procedure/functions in other scripts be called.
3) Does it cause a conflict to multiple llListens running on the same/different channels for scripts on the same object?
4) Is there some other way around these problems?
Specifically what I want to do is have multiple scripts able to read and change global variables. I also would hope to have llListen on the same channel with different scripts. Being able to call procedures within other scripts is a bonus.
This for an ALife experiment. I'm trying to creating a script that runs biological processes, and then allow for an AI script. The idea is to create a virtual zoo where users compete and try to submit ideal AIs. IM me if you think this is cool!
_____________________
Tyrannosaur Foreplay! Roar! RL Blog
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
04-22-2006 10:11
> 1) Can scripts send messages back and forth?
Yes. Look up llMessageLinked for sending, link_message for receiving.
> Alternatively, can they use or modify a set of global variables.
No.
> 2) In the same thread, can procedure/functions in other scripts be called.
No.
> 3) Does it cause a conflict to multiple llListens running on the same/different channels for scripts on the same object?
I don't think so. I believe they'll all fire. Though it might be easier on resource use if you had one script pick up the listen, and then distribute it out within the object using link messages.
> Specifically what I want to do is have multiple scripts able to read and change global variables.
Your best bet might be to have a 'data manager' script that handles the data, and accepts get/set link message commands. Then the other scripts communicate with this script to retrieve/change the values. You'll have to take care of synchronization, if you need data locking of any kind, or multiple operations need to be treated as a single atomic unit. Basically, since everything is asynchronous, one script can come in and change the value while another script is trying to do something with it. But if the triggers are independent, this is probably the behavior you want anyway.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
04-22-2006 10:11
Within the same object, you want to use llMessageLinked. It has many advantages over inter-script chat communication. http://secondlife.com/badgeo/wakka.php?wakka=llMessageLinked
|