Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Identifying linked prims without knowing link number

Dire Graves
Registered User
Join date: 3 Sep 2007
Posts: 51
09-12-2007 16:26
OK...
I have this big box 20x20x10 (16 prims) and I want to be able to change the colors of different faces of the prims that make up this box. basically every face that is white may not always be white but those faces will always be the same color and there are 3 different colors being used at any given time for this box. I hope this makes sense.

My plan is to put a script into each prim that will say the colors of each face along with some way to identify that prim but I don't want to use the link number because I'm always unlinking and relinking so it will change too much. Once I get all the color info I'll delete the scripts and just use a script in the root prim to change the colors on command.

So my question is how can i identify each prim without using the link number and preferably without having to have a script in each prim.

Thanks!
DanielFox Abernathy
Registered User
Join date: 20 Oct 2006
Posts: 212
09-12-2007 16:41
If you can name each prim a different thing, just loop from 2 to llGetNumberOfPrims() and call llGetLinkName() on each prim, saving the linknumber
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
09-12-2007 17:29
if you had a central root prim you could get the local positions of each prim in the link set and quickly determine which it is as you know the geometry of the 'box' perhaps.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-12-2007 17:52
If I understand what you are wanting then..........
Just put a script in each prim that will say it's colors if you touch it. As long as a script has a touch event and isn't passing it's touches then it doesn't matter if it is in a linkset, each prim you touch will still say just it's colors.

Once you are finished and ready to just use the script in the root prim then you can use this to determine each prim's link number:

CODE

default{
touch_start(integer n){
string link = (string) llDetectedLinkNumber(0);
llOwnerSay("I am link # " + link);
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Dire Graves
Registered User
Join date: 3 Sep 2007
Posts: 51
09-12-2007 20:31
From: DanielFox Abernathy
If you can name each prim a different thing, just loop from 2 to llGetNumberOfPrims() and call llGetLinkName() on each prim, saving the linknumber


Cool!, I thought I named all the prims when I named the whole linked object and then when I broke the links i noticed that one of them was back to being named "object" again. but now I see that the names are permanent. Thanks.

Ok, now does anyone know if there is a way to find out what region default sun is set to at any given time? as in sunrise, noon sunset or midnight? I would like to have the prims change color when the sun changes. If there is not a way of checking this does anyone know how often the sun changes? maybe I can use a timer.
DanielFox Abernathy
Registered User
Join date: 20 Oct 2006
Posts: 212
09-13-2007 01:21
You can use llGetSunDirection

http://lslwiki.net/lslwiki/wakka.php?wakka=llGetSunDirection

Usually its accurate enough to just take the z component and look at that. The closer it gets to 0, the closer you are to sunset.
Dire Graves
Registered User
Join date: 3 Sep 2007
Posts: 51
09-13-2007 07:02
From: DanielFox Abernathy
You can use llGetSunDirection

http://lslwiki.net/lslwiki/wakka.php?wakka=llGetSunDirection

Usually its accurate enough to just take the z component and look at that. The closer it gets to 0, the closer you are to sunset.


Thanks. I guess I should keep using the old wiki, it has lots more info. So it seems like if I were to record the suns Z positions at the beginning and ending of each sun state I should be able to pretty accurately predict when it will change. I'll have to experiment a little with this..