Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Linking a scripted prim with another

Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
11-19-2006 04:26
I have a prim with poses and a script that let you touch it to choose between the poses in it, and it works fine. What I want to do is to link it to another prim (like chair, bed, or other items) and be able to click anywhere on linked prims and still be able to choose poses and execute the pose. The prim with the poses and script would also have invisible script inside so it dont show.

Anyone who could help me with this.????
Corey Braendle
Registered User
Join date: 26 Oct 2006
Posts: 27
11-19-2006 04:35
To communicate between prims you will need to use Linked Messages.

These come in the form of a function, and an event handler.

Lets take the following bit of code for the prim you touch.

CODE

integer count;

default
{

touch_start(integer a)
{
count++;
llMessageLinked(LINK_SET, count, "CHANGE POSE", NULL_KEY);

if(count == 3){
count = 0;
}
}

}


and the next bit of script would go in the recieving item.. bed/chair etc...

CODE

default
{

link_message(integer snum, integer num, string str, key id)
{
if((num==1) && (str=="CHANGE POSE")){
// Change to pose 1
}

if((num==2) && (str=="CHANGE POSE")){
// Change to pose 2
}

if((num==3) && (str=="CHANGE POSE")){
// Change to pose 3
}
}

}


Have a read over that. Im extremely tired at the time of writing so if theres any mistakes in my code then feel free to correct it anyone.

Hope this helps.
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
11-19-2006 06:00
Thank you for the script, and I can see it working, but what I want to do is touch the bed/chair to trigger the poses in the poseball. So all clicking should be done on the bed/chair, both for "sit" and for changing poses. Tested your script, but cant see I get that function. I would probably need to use some linked messages, but dont know much about scripting.

Anyone please??
Corey Braendle
Registered User
Join date: 26 Oct 2006
Posts: 27
11-19-2006 06:59
Well I should imagine that would just mean flipping the scripts around?

Putting the link_message() handler within the poseball and the llMessageLinked functions within the bed/chair etc.

To do this though the poseball + bed or whatever must be a linkset. they cannot be seperate non-linked prims.
Get Bussy
Registered User
Join date: 9 Jul 2006
Posts: 27
11-19-2006 07:09
yes, but how do I make the avatar sit on the poseball by clicking sit anywhere on the linked prims???
Resolver Bouchard
Registered User
Join date: 19 Jul 2006
Posts: 89
11-19-2006 07:52
Try making the poseball the root(?) prim i.e. the one you select last when linking.
Corey Braendle
Registered User
Join date: 26 Oct 2006
Posts: 27
11-19-2006 14:02
From: Resolver Bouchard
Try making the poseball the root(?) prim i.e. the one you select last when linking.


What he said :D
Daisy Rimbaud
Registered User
Join date: 12 Oct 2006
Posts: 764
11-20-2006 08:05
Aha ...