|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-28-2007 00:24
OK - I'm modifying a hut-tub (full perms) - I have one object in which 7 prims contain scripts and each listen to a specified channel (eg. integer channel = 50  - there is a second object which also needs to use the same channel. So that means there are 8 scripts in 8 prims spread over two objects using the same channel. I need to configure all these scripts with the one notecard - how can i do it? (hope all this makes sense) Thank MervB 
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
10-28-2007 00:59
You can read a notecard by UUID: simply send the UUID of the notecard to all the scripts, to read from.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-28-2007 01:26
Struth - I didn't realise that - thanks
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-29-2007 02:14
Ooops sorry I've drawn a blank again - how do you send a UUID to a script - also wont the UUID change each time the item is rezzed? (I'm getting myself confused - I don't know about you  )
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
10-29-2007 02:49
The instance key of the object will change each time it's rezzed, but the uuid of the contained notecard will not, unless the notecard contents is changed and resaved. Since this is a configuration notecard, I'm assuming it's going to be changed by yourself or others at some point, so the notecard key is the wrong route to go. I think you're approaching this the wrong way (or being sent in the wrong direction by Jesrad.) Instead of using the notecard key, read the notecard with one of your 7 scripts in the 1st object, and that script will have the configuration data, and then transmit the configuration data to the other 6 scripts using llMessageLinked() with the LINK_SET constant to send the data to other scripts in the object. You can send the other 6 scripts the data in one shot with llMessageLinked(). Then, all that's left is to get the data over to the second object, which you can do with a listen event in the receiver object. You have 4 options to move the data from the initial script to the other object:
llWhisper () ...if you're second object will always be within a few meters... llSay () ...if you're within normal chat range... llShout() ...if you're within 100 meters... llRegionSay() ...if the second object can be anywhere within the same sim.
Now, you didnt mention the amount or types of data being passed, but, if you have multiple data types (i.e. a couple of integers and a string), cast the data into a string seperated by commas or some other delimiter, then move the string with llMessageLinked() and recast back into the different data types in the link_message event event, for example, let's say you have an integer to store the steam level, another integer to store the sound state, on or off, and a string variable to store "whatever"...
// sender script reads data from notecard above... steam_level = 3; // this is an integer variable sound = TRUE; // this is also an integer variable text = "whatever" // and your string...
// recast the whole 9 yards to a string and concantenate it all together seperated by commas (or whatever delimiter suits you).
string xmit_data = (string)steam_level + "," + (string)sound + "," + text;
// now send xmit_data over with llMessageLinked()
in the receiver scripts, in the link_message event, you can then parse the string to a list using:
list config_list = llParseString2List (str, ",", []);
where str is the receiver string specified in the link_message event. Then, you can read the data out of the list into the appropriate type of variable.
hope that helps
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-29-2007 07:30
Wow! thanks that is great feedback
|
|
Land Control
Alternate Personality
Join date: 5 Sep 2005
Posts: 9
|
10-31-2007 00:46
It's still a lot simpler if you have one script along the notecard, that sends the notecard's UUID as link message to all the other scripts.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
10-31-2007 01:48
Thats great Land but how do you do it? And wouldn't it effect lag - althought as it is only used on rezz --- the affect would be minimal.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
10-31-2007 02:54
From: Land Control It's still a lot simpler if you have one script along the notecard, that sends the notecard's UUID as link message to all the other scripts. Simpler? Perhaps, but just barely. You're still going to have to have separate calls to open the notecard in each of the other scripts, and then read the data from the dataserver events into the variables. The problem with the key method is if the configuration notecard is edited (and resaved), then the script has to be edited to update the notecard key, which is highly likely since it's a configuration notecard. The OP doesn's say if he plans to sell this item or not, but if he is, the last thing you want to do is allow access to the script to insert a new key. It opens up the script to resell, and it's cheasy to make an end user have to deal with copying and pasting keys when it's totally not necessary. By using my method, all one would need to do is change the configuration notecard, save, and reset the main script, or better yet, have the script reset itself on inventory change. The main script would distribute the read data as per my previous post, and you're done. EDIT: Not to mention it's alot easier on the asset server to make one call instead of 8. 
|