Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linked Prims and common Script

Vida Jameson
Iris of Egypt
Join date: 23 May 2008
Posts: 3
05-29-2008 00:46
Assuming that i have a object with 5 objects are Linked (Linked 5 object)

2 of the linked objects have script respectively.....

but.. i want a way to have one script file written in the whole linked object and work with other linked object.

Say, the whole object has a script and it need to handle event happened in other object and change the state of other linked objects.

Is it possible? if so, How?
Sean Martin
Yesnomaybe.
Join date: 13 Sep 2005
Posts: 584
05-29-2008 02:59
From: Vida Jameson
Assuming that i have a object with 5 objects are Linked (Linked 5 object)

2 of the linked objects have script respectively.....

but.. i want a way to have one script file written in the whole linked object and work with other linked object.

Say, the whole object has a script and it need to handle event happened in other object and change the state of other linked objects.

Is it possible? if so, How?


One way is to use link messages.
Use something like this in your main script located in the root prim of your object:

From: someone
touch_start(integer touch)
{
llMessageLinked(LINK_SET,0,"MySignal",NULL_KEY);
}


Then in your child prims have it listen for link messages with something like this:

From: someone
link_message(integer sender_num, integer num, string message, key id)
{
if(message=="MySignal";)
{
//Do Stuff here when it hears the signal.
}
}
_____________________
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
05-29-2008 03:44
From: Vida Jameson
Assuming that i have a object with 5 objects are Linked (Linked 5 object)

2 of the linked objects have script respectively.....

but.. i want a way to have one script file written in the whole linked object and work with other linked object.

Say, the whole object has a script and it need to handle event happened in other object and change the state of other linked objects.

Is it possible? if so, How?


This really depends upon what events you want to handle, and what changes you wish to make to the other prims.

For example

you can detect which prim in the link set was touched but not which one was collided with.

useing llSetLinkParams you can set MOST parameters of a linked prim, unfortunately at the moment there is no way to retrieve the parameters of a linked prim. (/me agrees with Dora that this is needed).

So, with out going into all the details, the answer is Yes and No, just depends on what you are trying to do.
Vida Jameson
Iris of Egypt
Join date: 23 May 2008
Posts: 3
05-29-2008 04:14
Hi Beverly Ultsch and Sean Martin,

Thank you so much for sharing your idea. I am new to Scripting but i am learning a lot and its fun :)

Will get back to you once i try it.

I do have once doubt if we have more script in all the linked objects... but i plan to send a attacked string with the string message to determing which link_message to work on the sent message.

Thank you to both :)

Vida.