picture frame

 

 

Scripts name picture frame  
Purpose loads a texture by touching and saying the textures UUID  
script lanugages used lsl  
important settings for region ./.  
test on osgrid - trunk  6.2 SVN8132, XEngine  
source second life freebie, Ralf Haifisch  

 

integer listen1;

 

default

{

    state_entry()

    {

        llListenRemove(listen1);

        llSetTimerEvent(0.0);

    }

   

    on_rez(integer sparam)

    {

        llWhisper(0, "Touch the canvas to change pictures.");

        llResetScript();

    }

   

    touch_start(integer total_number)

    {

        if (llDetectedKey(0) == llGetOwner()) {

            llListenRemove(listen1);

            listen1 = llListen(0, "", llGetOwner(), "");

            llWhisper(0, "Say the key of the picture to be displayed. You have 30 seconds before I stop listening.");

            llSetTimerEvent(30.0);

        }

    }

   

    listen(integer channel, string name, key id, string message)

    {

        llSetTimerEvent(0.0);

        llListenRemove(listen1);

        key old = llGetTexture(2);

        llSetTexture(message, 2);

        llSleep(0.1);

        if ((string)llGetTexture(2) != message) {

            llWhisper(0, "That was not a valid key.");

            llSetTexture(old, 2);

        }

    }

   

    timer()

    {

        llSetTimerEvent(0.0);

        llListenRemove(listen1);

    }

}