My Mackenzie
Certified ratnut
Join date: 6 Aug 2004
Posts: 86
|
12-03-2005 19:43
 I finally give up and ask for help with link message, or get link number, whichever works best for my project. For a good while now i've tried to learn the link message thing, as so many people say listens are a cause of lag, and i don't want to contribute to it. I have an object that i want 1 listen event in (not on channel 0, and as opposed to listens in every prim in my object >.< and i understand the llListen functions and know how they work), and want to be able to issue 3 different commands. Imagine 5 prims, ill call them by numbers from 1 to 5. for the first command prim 1 and 2 become invisible, and the rest visible. Second command prim 1 and 2 become visible again and the rest go invisible. Third command prim 1 and 2 and 5 go invisible and 3 and 4 become visible. Now i have looked for any kind of example link message script, and i have tried making my own but i might as well be trying to read russian  , and all i know in russian is *da*. If there is an example out there with i could learn from, could someone point me to it and ill figure it out eventually? And the Wiki is no help as i have to be able to read more than just the command....iv'e been there done that couldnt get it to work, as much as i hate to admit it. I just don't grasp how to set up the root prim and child prim scripts.... Thank you in advance.
_____________________
You cannot stop the birds of sorrow flying over your head, but you can prevent them from nesting in your hair.
Chinese saying.
Atlantic Dreams Designs (ADD's) in Grindlewald (229, 195)
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
12-03-2005 20:46
you dont really have to specify
-2 = All other prims in the object besides the prim the function is in. -1 = All prims in the object.
parent script: llMessageLinked(-2,0,trigger,NULL KEY);
child script: integer place; link_message(integer sender_num, integer num, string str, key id) if place== 0 {do stuf;f ++place;} else if place ==1 {do stuff; ++place;} else if place ==2 {do stuff; place =0;}
|
My Mackenzie
Certified ratnut
Join date: 6 Aug 2004
Posts: 86
|
12-03-2005 20:52
Thanks will try that 
_____________________
You cannot stop the birds of sorrow flying over your head, but you can prevent them from nesting in your hair.
Chinese saying.
Atlantic Dreams Designs (ADD's) in Grindlewald (229, 195)
|
Ethan Cinquetti
Registered User
Join date: 5 Jul 2005
Posts: 24
|
12-03-2005 20:55
From: My Mackenzie
for the first command prim 1 and 2 become invisible, and the rest visible. Second command prim 1 and 2 become visible again and the rest go invisible. Third command prim 1 and 2 and 5 go invisible and 3 and 4 become visible.
Hi! Let's see if we can get this done  A more experienced scripter may come along presently with a better example, but here's what I'd try first. Now, prim #1 needs to be your root prim, the last one you select when you're linking the script together. I'm going to call your three commands "mode 1", "mode 2", and "mode 3." Here's a script that could go in your root prim.
string selected_mode; string mode_1 = "nnyyy"; string mode_2 = "yynnn"; string mode_3 = "nnyyn";
integer cmd_channel = 21; // Whatever private channel you're using
// // This process_msg function is going to be in every prim's script. //
process_msg( string mode_string ) {
integer my_index = llGetLinkNumber() - 1; string my_instruction = llGetSubString( mode_string, my_index, my_index ); if ( "y" == my_instruction ) // Turn myself VISIBLE here else // turn myself INVISIBLE here }
default { state_entry() { llListen( cmd_channel, "", "", "" ); }
listen( integer channel, string name, key id, string message ) { selected_mode = ""; if ( "mode 1" == message ) selected_mode = mode_1; if ( "mode 2" == message ) selected_mode = mode_2; if ( "mode 3" == message ) selected_mode = mode_3; if ( "" != selected_mode ) { llMessageLinked( LINK_ALL_OTHERS, 0, selected_mode, NULL_KEY ); // The root prim can process its message directly. process_msg( selected_mode ); } }
}
Then, in each child prim, have this:
// // Here's the copy of the function from above, that matches link number // to visibility switch in the string. //
process_msg( string mode_string ) {
integer my_index = llGetLinkNumber() - 1; string my_instruction = llGetSubString( mode_string, my_index, my_index ); if ( "y" == my_instruction ) // Turn myself VISIBLE here else // turn myself INVISIBLE here }
default { link_message( integer source, integer msg_family, string message, key id ) { process_msg( message ); } }
|
My Mackenzie
Certified ratnut
Join date: 6 Aug 2004
Posts: 86
|
12-03-2005 21:32
thanks to you too Ethan
_____________________
You cannot stop the birds of sorrow flying over your head, but you can prevent them from nesting in your hair.
Chinese saying.
Atlantic Dreams Designs (ADD's) in Grindlewald (229, 195)
|