Difference between revisions of "Touch Texture Switch.lsl"

From Second Life Wiki
Jump to navigation Jump to search
(added script)
 
m (<lsl> tag to <source>)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<lsl>
<source lang="lsl2">
//*********************************************************
//*********************************************************
//                  -Touch Texture Switch-              *
//                  -Touch Texture Switch-              *
Line 7: Line 7:
//Attribution: None required, but it is appreciated.
//Attribution: None required, but it is appreciated.
//Created: December 16, 2009
//Created: December 16, 2009
//Last Modified: December 16, 2009
//Last Modified: March 17, 2010
//License: Public Domain
//License: Public Domain
//Released: Wednesday, December 16, 2009
//Released: Wednesday, December 16, 2009
Line 40: Line 40:
//don't change below
//don't change below
integer currentstate;//the state its in either TRUE or FALSE
integer currentstate;//the state its in either TRUE or FALSE
swith(string texture)
switch(string texture)
{
{
     llSetTexture("texture UUID1",ALL_SIDES);
     llSetTexture(texture, side);
    currentstate = ~currentstate;//swith states
     llSleep(time);
     llSleep(time);
}
}
Line 50: Line 51:
     {
     {
         if(currentstate)
         if(currentstate)
             swith(texture1);
             switch(texture1);
         else
         else
             swith(texture2);
             switch(texture2);
        currentstate = ~currentstate;//swith states
     }
     }
}
}
</lsl>
</source>

Latest revision as of 09:35, 25 January 2015

//*********************************************************
//                   -Touch Texture Switch-               *
//*********************************************************
// www.lsleditor.org  by Alphons van der Heijden (SL: Alphons Jano)
//Creator: Bobbyb30 Swashbuckler
//Attribution: None required, but it is appreciated.
//Created: December 16, 2009
//Last Modified: March 17, 2010
//License: Public Domain
//Released: Wednesday, December 16, 2009

//Status: Fully Working/Production Ready
//Version: 1.0.1
//Disclaimer: These programs are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
//            even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 



//Name: Touch Texture Switch.lsl
//Purpose: To change texture on touch
//Description: This script will change the texture on a prim when touched between the two given
//             texture and then sleep.
//Directions: Add script to prim. Change UUIDs in script and save.
//Compatible: Mono & LSL compatible
//Other items required: None
//Notes: Lagless, timerless, Originally written for EternalSailorJupiter Korobase
//     : llSetTexture has a .2 second delay, so there is automatically a .2 second delay built in.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//global variables you may change
string texture1 = "UUID of texture 1";//UUID of texture 1 (or inventory name if in inventorY)
string texture2= "UUID of texture 2";//UUID of texture2
float time = 0.0;//time to sleep in seconds
integer side = ALL_SIDES;//which side to change texture on


/////////////
//don't change below
integer currentstate;//the state its in either TRUE or FALSE
switch(string texture)
{
    llSetTexture(texture, side);
    currentstate = ~currentstate;//swith states
    llSleep(time);
}
default
{
    touch_start(integer total_number)
    {
        if(currentstate)
            switch(texture1);
        else
            switch(texture2);
    }
}