Join us in Outworldz at or follow us:

[Table of Contents]

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Linking Link_Numbers_Getter  


I made a function like this for my Flying Tako sailboat so that I didn't have to worry about linking the various parts in just the right order, or have to remember which part was link #14 (or which link number the sail was). If all your child prims have unique names (like "mast" or "door"), then you can use this function to automatically get the link numbers for them and assign them to variables in your script. This makes using llMessageLinked much easier - for example, you could just use a new variable DOOR to send a link message to the door on your vehicle. Or use the DOOR variable to change the color of your door in llSetLinkColor.

Category: Linking
By : Kanker Greenacre
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Link_Numbers_Getter
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Link_Numbers_Getter_1.lsl
1 integer PRIM1;
2 integer PRIM2;
3 integer PRIM3;
5 getLinkNums() {
6 integer i;
7 integer linkcount=llGetNumberOfPrims();
8 for (i=1;i<=linkcount;++i) {
10 if(str=="prim1") PRIM1=i;
11 if(str=="prim2") PRIM2=i;
12 if(str=="prim3") PRIM3=i;
13 }
14 }
16 default {
18 state_entry() {
19 getLinkNums();
20 llMessageLinked(PRIM1,0,"Test","");
21 llMessageLinked(PRIM2,0,"Test","");
22 llMessageLinked(PRIM3,0,"Test","");
23 }
25 }

Back to the Best Free Tools in Second Life and OpenSim.