Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Prim to Prim Communication

Oshi Leakey
Registered User
Join date: 21 Jan 2008
Posts: 10
11-12-2008 15:07
Hi guys, hopefully this is a pretty simple question, Im sure there is a tutorial out there but I havent been able to find it searching these forums or google, so I pose my question here...

I would like to create a little touch screen type of object, composed of a few linked prims, that when one button (prim) is pressed, it changes the texture of another prim. This requires prim to prim communication and I am just a little confused on how to achieve this. Any help is appreciated, thanks!

Joshua
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-12-2008 16:06
If they're linked, just use llMessageLinked and link_message. Otherwise you'll need to use chat and listens or some other form of less direct communication.
_____________________
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
11-12-2008 17:13
Note however that it MAY NOT require communication between prims. If only one prim is going to be touched, or if you don't mind handling all the touches from a script in the root prim, you COULD do it using llSetLinkPrimitiveParams() instead of link messages. See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetLinkPrimitiveParams
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
11-13-2008 16:08
From: Oshi Leakey
I havent been able to find it searching these forums or google,


Never been to the LSL Wiki/Portal http://wiki.secondlife.com/wiki/LSL_Portal yet?
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-13-2008 16:23
With linked prims on a hud you pass the touches to the root w/script and use either llDetectedLinkNum or llGetLinkName to see which prim was touched. Here is a basic example script, link 4 prim together and then drop this script in it:

CODE

integer prim_num;
string prim_name;
vector color;

default {
touch_start( integer n ) {
prim_num = llDetectedLinkNumber(0);
prim_name= llGetLinkName(prim_num);
if(prim_num == 1){
color = <1, 1, 1>;
llOwnerSay("I am also the Root Prim");
}
else if(prim_num == 2) color = <0, 0, 1>;
else if(prim_num == 3) color = <0, 1, 0>;
else if(prim_num == 4) color = <1, 0, 0>;
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, color, 0.6]);
llOwnerSay( "Prim name: " + prim_name +
", link #" + (string)prim_num + " touched." );
}
}
_____________________
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