Typing linkset alpha toggle

From Second Life Wiki
Revision as of 18:11, 24 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Typing linkset alpha toggle

--BETLOG Hax UTC+10: 20090928 1705 [SLT: 20090928 0005]
Put script in root prim of your fancy "i am typing now" novelty prim keyboard.
Start typing -> prims become visible
Stop typing -> prims become INvisible
Only one script required.

I just wrote it, didn't test much, It's trivial but there will probably be a glaring oversight in there somewhere.

//==============================================================
// BETLOG Hax
// UTC+10: 20090928 1642 [SLT: 20090927 2342]
// For Jullalana Mornington because I saw the ye-olde one she was using had a script in every prim. This sort of script does NOT need a script in every prim. Yes realy.
//----------------------------------
//        **** LICENCE START ****
// http://creativecommons.org/licenses/by-sa/3.0/
//             Attribution licence:
// You must:
//    -Include this unaltered licence information.
//    -Supply my original script with your modified version.
//    -Retain the original scripts' SL permissions. [+c/+m/+t]
// Or:
//    -Link to the wiki URL from which you copied this script.
//        https://wiki.secondlife.com/wiki/Typing_linkset_alpha_toggle
//    -Document: "Uses parts of <scriptname> by BETLOG Hax"
//        **** LICENCE END ****
//==============================================================
integer     gVisible;
//----------------------------------
f_toggle(integer visible)
{   llSetLinkAlpha(LINK_SET, (float)visible, ALL_SIDES);
}
//----------------------------------
f_perms() //make it still operate when entering no script areas
{   if(llGetAttached())
        llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
}
//==============================================================
default
{   state_entry()
    {   if(llGetAttached())//DEV
            f_perms();
        else
            llOwnerSay("You must be wearing me for this to operate.");
    }
    attach(key id) 
    {   f_perms();
    }
    run_time_permissions(integer perm) 
    {   if(perm & PERMISSION_TAKE_CONTROLS)
        {   f_toggle(gVisible=FALSE);
            llSetTimerEvent(0.444444);
        }
    }
    control(key id, integer pressed, integer change) 
    {   //make it still operate when entering no script areas
    }
    timer() 
    {   if(AGENT_TYPING & llGetAgentInfo(llGetOwner()) )
        {   if(!gVisible)
            {   f_toggle(gVisible=TRUE);
            }
        }
        else
        {   if(gVisible)
            {   f_toggle(gVisible=FALSE);
            }
        }
    }
    
}
//==============================================================