This will enable you to cloak an object by saying
/876 cloak and uncloak it by saying
/876 uncloak.
This script is open source and free to modify copy and play around with.
If you make any improvements to this script please let me know (Tribal Toland).
// Cloaking/ Uncloaking script by Tribal Toland
// released through www.sparticarroll.com
// sC 22jan07 sparti Carroll layout changes, countdown and SetText for display version added
integer iFlagOwnerOnly = 0;
countdown(integer start_at) {
while (start_at > 0) {
llSleep(1);
llWhisper(0, (string)start_at);
start_at -= 1;
}
}
reset() {
llSetText("Cloak and Uncloak script by Tribal Toland - Open Source",<1.0,1.0,1.0>,1.0);
}
default {
on_rez(integer start_param) {
reset();
}
state_entry() {
reset();
key kOwner = llGetOwner();
// 876 is the channel that the script will listen on for its commands
if (iFlagOwnerOnly) {
llListen(876,"",kOwner,""); // only listen to owner
} else {
llListen(876,"","",""); // OR listen to anyone
}
}
touch_start(integer num_detected) {
llSay(0, "Say /876 cloak or /876 uncloak to hide or show this object");
}
listen(integer channel, string name, key id, string message) {
if (message == "cloak") { // Was "cloak" the message which was heard ?
llWhisper(0,"Cloaking Initalised"); // if it was then ...
countdown(3);
// Then the status of the object to phantom, enabling objects to pass though it
llSetStatus(STATUS_PHANTOM, TRUE);
llWhisper(0,"Cloaking");
llSetAlpha(0,ALL_SIDES); //This will cloak the object by setting it's alpha to 0
}
else if (message == "uncloak") { // or, was the message "uncloak"
llWhisper(0,"Uncloacking Initalised");
countdown(3);
//not phantom any more, objects will no longer be able to pass though it
llSetStatus(STATUS_PHANTOM, FALSE);
llWhisper(0,"Uncloaking");
llSetAlpha(1,ALL_SIDES);
}
}
}