User:Decimus Schomer/Scripts/Texture changer

From The SchomEmunity Wiki
< User:Decimus Schomer‎ | Scripts
Revision as of 20:55, 13 January 2008 by Rebecca (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Decimus' user page | Decimus' talk page | Decimus' scripts | Decimus' script libraries | Decimus' projects
Main scripts page | Toggling Rotate script | UUID-getter scripts | Texture changer | Channel spier | Chatbot | Jump slab | Emailer | Fractal viewer | Grammar analyser | SPD viewer


This script changes the texture of an object in response to specific text.

list TEXTURES = [ // "text", "texture"
    "open", "opened",
    "close", "closed"
];

default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),""); // Multiple listens are bad, if they're all on the same channel.
    }
    
    listen(integer channel, string name, key id, string message)
    {
        integer pos = llListFindList(TEXTURES,[llToLower(message)]);
        if(~pos)
        {
            llSetTexture(llList2String(TEXTURES, pos+1),ALL_SIDES);
        }
    }
}

To add textures, add another pair of entries to TEXTURES in the format "message to say", "texture-name-or-key". The message should be lowercase, and the name is case sensitive.