//// "Listen" CONTROLLER TEMPLATE v1.1 - by Jopsy Pendragon - 5/10/2008
//// You are free to use this script as you please, so long as you include this
line:
//** The original 'free' version of this script came from THE PARTICLE
LABORATORY. **//
// SETUP: Drop this CONTROLLER TEMPLATE script into the same object with
// your PARTICLE TEMPLATE. It should be operational immediately.
// USAGE: Type /1 on (to start particles) and /1 off (to disable them)
// WARNING: This script is significantly DIFFERENT than the "Listening" TARGET
TEMPLATE!
// Also, this script will only listen for a new owner AFTER the new owner rezzes
the object
// in world. If you have them Buy-Original, it will still listen-to/obey the old
owner.
// Customize these options:
integer LISTENER_CHANNEL = 1;
string ON_COMMAND = "remote";
string OFF_COMMAND = "noremote";
integer OWNER_ONLY = FALSE; // FALSE = listen to anyone.
integer TARGET_SPEAKER = FALSE; // TRUE = particles target prim or avatar that
spoke.
// enable PSYS_PART_TARGET_POS_MASK in particle template for targeting.
string CONTROLLER_ID = "M"; // see more about CONTROL TEMPLATES at end.
default {
on_rez(integer n) { llResetScript();}
state_entry() {
key listen_to;
if ( OWNER_ONLY ) listen_to = llGetOwner(); else listen_to = NULL_KEY;
llListen( LISTENER_CHANNEL, "", listen_to, "" );
}
listen( integer chan, string name, key target_id, string mesg ) {
if ( mesg == ON_COMMAND ) {
if ( TARGET_SPEAKER ) {
llMessageLinked( LINK_SET, 2, CONTROLLER_ID, target_id );
} else {
llMessageLinked( LINK_SET, TRUE, CONTROLLER_ID, NULL_KEY );
}
} else if ( mesg == OFF_COMMAND ) {
llMessageLinked( LINK_SET, FALSE, CONTROLLER_ID, NULL_KEY ); // send command
}
}
}
//========================================================================
//======================== USING CONTROL TEMPLATES =======================
//
//
// By default, control templates will turn EVERY particle template in the
// same object ON or OFF. If you want particle templates to only listen
// to specific controller templates, then give both matching
// CONTROLLER_ID's. (something other than "A", like: "B" for example).
//==================================== END ===============================