Basic Alpha (transparency) SHOW/HIDE ( V1 )

Written by: Headmaster
/ V1 //
 
string command = "switch"; // Place the command to chat here. The same command will switch on and off.
 
integer channel = 1; // Place channel to use here (must be a positive if an avatar is chatting on it).
 
//////////////////////////////////////////////////////////////////////////////////////////////////////
 
integer on; // Store the state of transparency.
 
Switch()
{
    llSetLinkAlpha(LINK_SET, ((float)on), ALL_SIDES); // This setting will turn a whole link_set transparent or visible.
    on = (!on);
}
 
default
{
    state_entry()
    {
        llListen(channel, "", "", command); // This script is listening to everyone all the time.
//        llListen(channel, "", llGetOwner(), command); // Delete the "//" at the beginning of this line...
                                                        // ...and add "//" at the beginning of the line above...
                                                        // ...to make This script listen to only the owner.
    }   // Switching the listen off at times would be better to reduce lag. But when??
    touch_end(integer nd)
    {
//        if(llDetectedKey(0) == llGetOwner()) // Delete the "//" at the beginning of this line to make touches only respond to owner.
        Switch(); // Call the switching function.
    }
    listen(integer chan, string name, key id, string msg)
    {
        Switch(); // Call the switching function.
    }
}
[edit]

 

Category: