Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

synco execution of child movements?

Arno Hauptmann
Registered User
Join date: 25 Nov 2005
Posts: 2
12-15-2005 11:27
I have a hatch. The hatch consists of 4 panels/prims. When I touch the hatch I want it to open - each panel travels in its own direction (up, down, left, and right) and comes back to its original position again. Kind of like opening an iris, or petals on a flower. My problem is that the 4 panels do not open in syncro. 1st, one starts to move, then another, then another, etc. It's real sloppy looking and random. I'm new to SL of course, so there's probably a better way to do this, but any help getting all 4 panels to open at the same time would be greatly appreciated.
Here's my code. To save space, I've included the controller and only 1 door panel. The other 3 panels code are the same except for the direction they move:

//door panel, 1 of 4. Listens for MasterController
MoveDown(integer distance){
llSetPos(llGetLocalPos() + <0,0,-distance>;);
}
MoveUp(integer distance){
llSetPos(llGetLocalPos() + <0,0,distance>;);
}

default
{
state_entry(){}

link_message(integer sender_number, integer number, string message, key id){
if(message == "Open_Hatch";){
llSay(0, "Bottom quadrant Moving.";);
MoveDown(1);
MoveUp(1);
}
}
}

//MasterController - sends messages to the 4 door panel prims
key operator;
default{
state_entry(){
llSay(0, "Hello, Avatar! Press me to enter.";);
}

touch_start(integer total_number){
llSay(0, "Opening Hatch.";);
llTriggerSound ("34c9a0b4-5820-0eb3-a639-61dcd5bb7f2b",1.0 );
llMessageLinked(LINK_ALL_CHILDREN, 0, "Open_Hatch", operator);
}
}

Thanks,
Arno
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-26-2005 15:39
Bumping this because the question appears to be unanswered. Reposting the code, above, in more readable form:

CODE
//door panel, 1 of 4. Listens for MasterController

MoveDown(integer distance)
{
llSetPos(llGetLocalPos() + <0,0,-distance>);
}

MoveUp(integer distance)
{
llSetPos(llGetLocalPos() + <0,0,distance>);
}

default
{
state_entry()
{
// Empty
}

link_message(integer sender_number, integer number, string message, key id)
{

if(message == "Open_Hatch")
{
llSay(0, "Bottom quadrant Moving.");
MoveDown(1);
MoveUp(1);
}
}
}


CODE
//MasterController - sends messages to the 4 door panel prims

key operator;

default
{
state_entry()
{
llSay(0, "Hello, Avatar! Press me to enter.");
}

touch_start(integer total_number)
{
llSay(0, "Opening Hatch.");
llTriggerSound ("34c9a0b4-5820-0eb3-a639-61dcd5bb7f2b",1.0 );
llMessageLinked(LINK_ALL_CHILDREN, 0, "Open_Hatch", operator);
}
}


Edit: I reread the code, and this appears to be working. I guess the PHP will help whomever needs this next, though.
_____________________
---