Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripts and Linked Prims

Cramer Widdershins
Registered User
Join date: 1 Feb 2007
Posts: 13
02-17-2007 14:07
I wanted to know how I could link several prims together when one of the prims has a script within it and not have all of the prims react to the script. Here's an example - a small shack with a door that contains a script that opens and closes the door. Whenever I touch the door the entire shack moves instead of just the door.

I know that somehow this can be done because I have bought things that can be positioned anywhere but contain doors that open and close that don't effect the entire object. For instance, I bought kitchen cabinets, 3 of the cabinets have doors that open and close. I can reposition the entire cabinet object as one piece and when I click each of the doors, they open and close as normal.

Any ideas?

Cramer :)
Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
02-17-2007 14:22
I was working some with that earlier today and had some problems. llSetPos didn't work for some reason. Found this on the wiki:

Q: Shouldn't this be:
llSetPos(llGetPos() + <0, 0, 1>;)?
A: No, not for child prims -- their position is always relative to the parent. If you want to move it relative to its current
offset from the parent, you'd use:
llSetPos(llGetLocalPos() + <0, 0, 1>;);


Oops, don't know what happened to the font, LOL. Hope it helps.
Cramer Widdershins
Registered User
Join date: 1 Feb 2007
Posts: 13
02-17-2007 14:45
So does this mean that for every script within the linked collection of prims I would have to edit the script an enter in the relative position of all the child prims to the parent? It seems like this should be easier than that.

I know that if I select all the prims without linking and just choose to "take" them, they will create an object in my inventory. If in the properties I choose to not allow others to modify the object, would this solve the problem? Of course this would only be a possible solution for other people buying my shacks and not me, but that would be ok. What do you think and can you think of anything else?
Sterling Whitcroft
Registered User
Join date: 2 Jul 2006
Posts: 678
02-17-2007 15:24
Hmmmm.
I think you should only need ONE script to do this...in ONE prim.
So you have a hut (made with several prims) and a door (could be one or more prims).
(Optional, not required, but useful): Link the hut (not including the prims for the door.
Required (if more than one prim in the door): Link the Door Prims.

Do NOT link the door and hut prims together.

In this setup, no scripts are required EXCEPT one in the root prim of the door.
The root prim is the Last Selected prim as you collect them to link. if you have a one prim door, then its just that prim. No other scripts necessary...

And the script that moves the door, should use GetLocalPos as Woopsy describes...That way if you move the hut, the door will still work.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
02-17-2007 15:41
Try the timeless prototype door in the library.
Spuds Milk
Registered User
Join date: 28 Sep 2004
Posts: 94
02-19-2007 02:12
when you link things, the script often goes to the root prim, remove it from there, edit parts, and put into the correct prim. as the people above have stated, need to make sure your scopr of change is set correctly
Cramer Widdershins
Registered User
Join date: 1 Feb 2007
Posts: 13
02-19-2007 13:39
Thanks everyone for your help. The timeless door script works great.