Sender script to be placed in parent prim:
CODE
//This sender script acts as an touch activated switch to show/hide other linked prims
//When touched it sends MessageLinked commands...
// to link_message receiver scripts in the linked prims to make them visible/invisible (on/off).
//To see this script in action create one cube and three spheres.
//Name the cube Parent/switch and the three spheres top, middle, bottom.
//stack the spheres on top of the cube, bottom, middle, top.
//Link the three spheres to the cube so the cube is the parent prim.
//Place this MessageLinked script in the cube, the parent prim.
//Place the other three Link_message scripts, one in each sphere with the matching name.
default //sends message to turn bottom on and others off.
{
touch_start(integer total_number)
{
//llWhisper(0, "bottom on");
llMessageLinked(LINK_SET, 0, "bottomOn", NULL_KEY);
llMessageLinked(LINK_SET, 0, "middleOff", NULL_KEY);
llMessageLinked(LINK_SET, 0, "topOff", NULL_KEY);
state middleOn;
}
}
state middleOn //sends message to turn middle on and others off.
{
touch_start(integer total_number)
{
//llWhisper(0, "middle on");
llMessageLinked(LINK_SET, 0, "bottomOff", NULL_KEY);
llMessageLinked(LINK_SET, 0, "middleOn", NULL_KEY);
llMessageLinked(LINK_SET, 0, "topOff", NULL_KEY);
state topOn;
}
}
state topOn //sends message to turn top on and others off.
{
touch_start(integer total_number)
{
//llWhisper(0, "top on");
llMessageLinked(LINK_SET, 0, "bottomOff", NULL_KEY);
llMessageLinked(LINK_SET, 0, "middleOff", NULL_KEY);
llMessageLinked(LINK_SET, 0, "topOn", NULL_KEY);
state default;
}
}
Receiver script to be placed in bottom child prim:
CODE
// link_message reciever to turn alpha/transparancy on and off
// place this script in the bottom sphere
// it listens for the messages "bottomOn" and "bottomOff".
// to make it do other things replace the "SetAlpha" call with a different one
// or add calls to it.
Alpha_On()
{
llSetAlpha(1.0,ALL_SIDES); //1.0 shows all of the texture, no transparency
}
Alpha_Off()
{
llSetAlpha(0.0,ALL_SIDES); //0.0 shows none of the texture, it is transparent.
}
default
{
link_message(integer sender, integer num, string message, key id)
{
if(message == "bottomOn") Alpha_On();
if(message == "bottomOff") Alpha_Off();
}
}
Receiver script to be placed in middle child prim:
CODE
//link_message reciever to turn alpha/transparancy on and off
// place this script in the middle sphere
// it listens for the messages "middleOn" and "middleOff".
// to make it do other things replace the "SetAlpha" call with a different one
// or add calls to it.
Alpha_On()
{
llSetAlpha(1.0,ALL_SIDES); //1.0 shows all of the texture, no transparency
}
Alpha_Off()
{
llSetAlpha(0.0,ALL_SIDES); //0.0 shows none of the texture, it is transparent.
}
default
{
link_message(integer sender, integer num, string message, key id)
{
if(message == "middleOn") Alpha_On();
if(message == "middleOff") Alpha_Off();
}
}
Receiver script to be placed in top child prim:
CODE
// link_message reciever to turn alpha/transparancy on and off
// place this script in the bottom sphere
// it listens for the messages "topOn" and "topOff".
// to make it do other things replace the "SetAlpha" call with a different one
// or add calls to it.
Alpha_On()
{
llSetAlpha(1.0,ALL_SIDES); //1.0 shows all of the texture, no transparency
}
Alpha_Off()
{
llSetAlpha(0.0,ALL_SIDES); //0.0 shows none of the texture, it is transparent.
}
default
{
link_message(integer sender, integer num, string message, key id)
{
if(message == "topOn") Alpha_On();
if(message == "topOff") Alpha_Off();
}
}