Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How Prims Comunicate?

Vuldalack Newall
Registered User
Join date: 8 Dec 2006
Posts: 10
01-02-2007 08:17
The question is simple, but i cant find a clear example of this.

If i have a root prim, and when i click it, want to change the position of a child prim, how do i set the path, how do i refer for this child prim.

Tankyou all
Allan Beltran
Registered User
Join date: 2 Dec 2006
Posts: 52
01-02-2007 08:27
From: Vuldalack Newall
The question is simple, but i cant find a clear example of this.

If i have a root prim, and when i click it, want to change the position of a child prim, how do i set the path, how do i refer for this child prim.

Tankyou all

Take a look at llMessageLinked() and llSetPos() in the Wiki

Basically, you send a message to the child prim when the root prim is clicked. The child prim must then accept that message using the link_message event to do whatever it is you tell it.

Let me know if you need a better example...
Vuldalack Newall
Registered User
Join date: 8 Dec 2006
Posts: 10
01-02-2007 08:37
In this case i need a script in every linked prim to listen the root "message", isnt it?

Theres some way to do this, without this script inside the child prim?

Anyway tank you for the help, ill study more about it.
Allan Beltran
Registered User
Join date: 2 Dec 2006
Posts: 52
01-02-2007 08:52
From: Vuldalack Newall
In this case i need a script in every linked prim to listen the root "message", isnt it?

Theres some way to do this, without this script inside the child prim?

Anyway tank you for the help, ill study more about it.
To my knowledge, the only way to change the position of a prim of a linked set via the root prim is by using llMessageLinked() and llSetPos() (or llSetPrimitveParams()). You could also use llSay,shout, whisper to tell the child prim to move, etc. But that would be pointless since the set is linked and that is what llMessageLinked() is for. Either way, yes, you would need a script in each prim you wish to change.

You could just place the script in the child prim and use its own touch_start event to trigger the move.
Martin McConnell
Registered User
Join date: 8 Sep 2006
Posts: 116
01-02-2007 11:20
Is it true that when you use a lot of Listen scripts in a sim the sim processing deteriates?
_____________________
Martin McConnell
Still an SL Virgin
Quote: "I'm saving myself"
Allan Beltran
Registered User
Join date: 2 Dec 2006
Posts: 52
01-02-2007 11:24
From: Martin McConnell
Is it true that when you use a lot of Listen scripts in a sim the sim processing deteriates?

I believe the llMessageLinked() method does not. In fact, I think I read something about it(linked_message) being 40% faster than using listen events (llSay, llWhisper,...)
Foo Spark
alias Bathsheba Dorn
Join date: 8 Nov 2006
Posts: 110
01-02-2007 14:15
From: Allan Beltran
I believe the llMessageLinked() method does not. In fact, I think I read something about it(linked_message) being 40% faster than using listen events (llSay, llWhisper,...)


I don't know the real dope, but if it's not incredibly stupidly implemented, llMessageLinked should be much easier on the sim than llListen because it does not have to filter all chat.
Vuldalack Newall
Registered User
Join date: 8 Dec 2006
Posts: 10
01-02-2007 18:56
Anyway the script is working very well.

Tank You a Lot Allan Beltran
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
01-03-2007 06:37
My only note here on performance is to use the num (integer) field for llMessageLinked() calls to pass your command, using the message (string) part only to pass data.

e.g in the root script:
CODE
llMessageLinked(LINK_ALL_OTHERS, 1024, "<1.0, 2.0, 1.5>", NULL_KEY);


And in the child script:
CODE
default {
link_message(integer x, integer num, string msg, key id) {
if (num == 1024) llSetPos((vector)msg);
}
}


That way link messages become MUCH more efficient that llSay, since not only are you only processing the string in the script that requires it (integer comparisons to determine the command are a LOT easier).
You can even go a step further if you're willing, and have the child prim TELL the root prim what it's link-number (llGetLinkNumber()) is (make sure this is updated if the linked-set changes). That way the root prim can send it's message ONLY to the prim that needs it.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)