Asha Arida Posted March 8, 2013 Share Posted March 8, 2013 I'm aware that the last prim you select in a linkset before linking becomes the root. But as far as I can tell, any other prims seem to have arbitrary link numbers, no matter which order I link them. How can I set specific link numbers to each prim? I need this because I have an object with several scripts that talks to specific prims (specifically targeted to link numbers to avoid cross talk) Link to comment Share on other sites More sharing options...
Ciaran Laval Posted March 8, 2013 Share Posted March 8, 2013 Can't you do it via link name, or is that where you're expecting crosstalk? Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 8, 2013 Share Posted March 8, 2013 Prims always link in the reverse of the order in which you selected them (i.e., the first one you select has the highest link number; the last one selected has the lowest and is therefore the root). Two things make that simple scheme problematic. (1) If you unlink and relink prims in a different order, the link numbers can get scrambled so they longer match what you coded in your script and (2) the link number that is reported in your Edit tool is not always reliable. That is, you can choose the Edit Selected box and select a child prim,. look at its link number in the Edit window, and get the wrong answer. It's frustrating as hell. When I am building, I often drop a simple sctript into the root prim that has a llSay(0,(string)llDetectedLinkNumber(0)); command in a touch_start statement, just so that I can get reliable numbers. That said, Ciaran is right. It's much safer to use prim names than prim numbers. They don't change arbitrarily. Just identify the child prims that you want to target with a little code snippet in the state_entry event integer i= llGetNumberOfPrims();while (i){ if (llGetLinkName(i) == "my_targeted_prim_name") { PrimList += [i]; //Where "PrimList" is a global list that you will check later } --i;} Then use that list of link numbers whenever you want to change those specific prims, as in integer i;for (i=0;i<llGetListLength(PrimList);++i){ // code to change each child prim with link number llList2Integer(PrimList,i)} 1 Link to comment Share on other sites More sharing options...
Asha Arida Posted March 8, 2013 Author Share Posted March 8, 2013 So the Edit window can report incorrect link numbers...No wonder I was getting confused. That's extremely helpful, thank you! Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 9, 2013 Share Posted March 9, 2013 Yeah, I ran into that problem again as recently as this morning. It seems to happen if I unlink some child prims in a link set but not all of them, and then either relink them in a different order or add a new prim to the linkset. If I remember to unlink everything and start fresh, I don't ever have the problem. Dropping my little temporary script into the root helps a lot. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted March 9, 2013 Share Posted March 9, 2013 Asha Arida wrote: So the Edit window can report incorrect link numbers...No wonder I was getting confused. That's extremely helpful, thank you! The Edit window not only can, but very frequently does, report incorrect link numbers. It's broken in all TPVs that use it, and always has been. I really wish Firestorm, Singularity and whoever else uses it would get rid of it. It's so much more reliable and, in the long term, safer to loop through the link set on_rez, in state_entry, and in the changed event, checking the prim names or descriptions and assigning their numbers to global variables with meaningful names, and refer to those in future. Then you can say stuff like if (llDetectedLinkNumber(0)== intFrontDoor) without having to worry about what link number the front door prim is, and without worrying about changing the script if you later have to relink the object. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now