Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting link numbers out of a linkset in a specific way?

Wolf Lumin
Registered User
Join date: 22 Sep 2003
Posts: 2
04-29-2009 02:21
I'm looking to write or locate a script that can be placed in the parent/root prim and which has a function that can be called that returns every prim's link number and name.

I do not want to put any scripts in the children. I can't find any information about a script that gets link numbers of prims in which the script DOES NOT reside.

If this is impossible (sad!) then I'd like some information on writing the script so that it sends scripts to all the children, after which they all report their linknumbers/name and then self-delete.

I'm in a position where I have several scripts that heavily depend on sending information to specific linknumbers which are always changing whenever I have to make changes to the linkset and it's frustratingly breaking those scripts every time! I want to make it where I can gather that information and make those scripts not hard-coded linknumbers, but instead, variables that can change on-command after I make modifications to the linkset.

Thanks!
Osprey Therian
I want capslocklock
Join date: 6 Jul 2004
Posts: 5,049
04-29-2009 02:34
Reports number, just pop into root. Name - dunno.

CODE

default
{
touch_start(integer num)
{
while(num != 0)
{
--num;
llSay(0,"/me link "+ (string)llDetectedLinkNumber(num));
}
}
}
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
04-29-2009 02:35
google llGetLinkPrimitiveParams.
Wolf Lumin
Registered User
Join date: 22 Sep 2003
Posts: 2
04-29-2009 03:16
Yeah, I have scripts that give the link number of the prim the script resides in. What I wanted is apparently impossible.

What a shame. I guess I'll go research how to make a script repopulate itself into all the children....
_____________________
Sig Pending...
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-29-2009 03:38
Wolf: you know the link numbers already. They start at 1 and go up to llGetNumberOfPrims().

CODE
list GetLinkNumbersAndNamesMatchingPrefix(string prefix)
{
integer n = llGetNumberOfPrims();
integer i;
list l;
integer prefixlen = llStringLength(prefix);
for(i = 1; i <= n; i++)
{
string s = llGetLinkName(i);
if(llGetSubString(s, 0, prefixlen-1) == prefix)
l += [i,s];
}
return l;
}
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Wolf Lumin
Registered User
Join date: 22 Sep 2003
Posts: 2
Aha!
04-29-2009 03:56
Thanks, Argent!

I can definately work this function into what I'm trying to accomplish. Now that I've seen it, I'm sure I remember a similar script that got linknumbers based on a prim name. I just couldn't for the life of me figure out how to get that information out of a loop. I blame the wee hours of the morning/lack of sleep ;)

Much obliged!
_____________________
Sig Pending...