LSL Wiki Mirror 10-5-2006: LibraryKeyboardScript

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
Ok, so here's my first addition to the library. Feedback welcome. bugs? Poor choice of implementation? Contact me in world.
Yes, I know it's commenty, but the comments aren't for you 733T 5cr!pt3r5 - it's to help newer people navigate, explain what's what - you don't need this script, anyway. XD

You can drop this in a rectangular prim and it should work.

Thanks to Strife for pointers/cleanup.

Max

//Max Case's Free Keyboard Script 1.0  04/18/2005
//Put it in a prim, attach it to yourself (or not) and watch as a keyboard magically appears whenever you type.
//Feel free to reuse, etc.  
//Please don't just resell this script. That would be lame, since I am giving it to you for free.
//naturally, if you build something nice off of it, sell that. 
//Or make a nice texture you would like to sell with keyboard script, that's ok. Just leave script open to all to see.
//Feedback/Rates/Donations/Hate Mail always welcome. Don't be shy.
//leave in the comments. they don't affect performance.
// – Max

key owner;
integer status;
key kbtextureYellow = "eef62334-e85e-b8f5-0717-19056bdbafde";

initialize()
{
        llSay(0, "Welcome to Max's Symple Keyboard.");
        llSay(0, "initializing...");
        llSetTexture(kbtextureYellow, 2);
        llSetTextureAnim(ANIM_ON | LOOP, 2, 4, 1, 0, 0, 4);
        llSetAlpha(0.0, 2);
        llSetTimerEvent(.5); //honestly you could make this shorter, but what would be the point? .5 seems to work nice.   
        owner = llGetOwner();
        status = 0;
}

default 
{
    
    state_entry()
    {
        if(llGetOwner() != owner) //checks to see if we have changed owner
        {
            initialize();
        }
    }
           
    on_rez(integer total_number) 
    {
        if(llGetOwner() != owner)
        {
            initialize();
        }
    }

    timer()
    {
        integer temp = llGetAgentInfo(owner) & AGENT_TYPING; // are we typing? thanks to Strife for rewrite here, though I find this sort of condensed logic can be confusing for non-programmer type, but this is definitely more efficient.
        if (temp != status) //status changed since last checked?
        {
            llSetAlpha(!status, 2);//flip the status (this makes it 1 or 0, instead of AGENT_TYPING or 0)
            status = temp;//save the current status.
        }
    }  
}


ScriptLibrary
There are 2 comments on this page. [Display comments/form]