Wednesday, May 11, 2022

Second Life Scripting

 


Rotate

default 

  {

    state_entry()

     {

      llSetText("", <1,1,1>,1);

      llTargetOmega(<0,0,1>, 0.2, 2);

     }

  }



COIN FLIP


integer coin_toss()

{

    if (llFrand(1.0) < 0.5) return TRUE;

    return FALSE;

}


//  Sometimes it is useful to get a random integer over a given range.  This is

//  a surprisingly tricky and emotive subject and has caused endless discussion

//  on the scripting groups. The primary cause of probability errors when

//  employing llFrand is to have a varying bin size on the edges of the range.

//

//  As the bracket notation indicates, [0.0, mag), the function is inclusive of

//  the 0.0 and exclusive of the entered value. Because an LSL floating point

//  number is only a subset of real numbers and does not have infinite

//  granularity, this schema will work for any float greater than float

//  t = 1.175494351e-38; at which value the function will return only zero. At a

//  float beyond this, a math error occurs.


//  Random integer generator:

//      Contributed by Mephistopheles Thalheimer,

//      original function posted by Hg Beeks


//  Returns a pseudo-random integer in the range of min to max inclusive.


//  Rationale:

//      Expands the range by 1.0 to ensure equal bin spacing on ends relative to

//      the middle of the range and then uses an integer cast to round towards

//      zero.


//  Caveats:

//      This function is not range checked and will fail if max < min


integer random_integer(integer min, integer max)

{

    return min + (integer)(llFrand(max - min + 1));

}


say(string message)

{

    llSay(0, message);

}


default

{

    touch_start(integer total_number)

    {

//      *near* 50:50 chance of "Heads" vs. "Tails"

        if (coin_toss()) say("Heads");

        else             say("Tails");


        integer n1 = random_integer(2, 8); // Return a random number between 2 and 8

        say("I chose a " + (string)n1);


    }

    }



Stand on Light up :)



integer count = 0;

vector ON_COLOUR = <1,1,1>;

vector OFF_COLOUR = <.667,.667,.667>;


default

{

state_entry()

{

llVolumeDetect(TRUE);

llSetColor(OFF_COLOUR,ALL_SIDES);

}


timer()

{

count = 0;


llSetColor(OFF_COLOUR,ALL_SIDES);

llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, .0 ] ) ;

llSetTimerEvent(0);

}


collision_start(integer num)

{

count++;


if (count == 1)

{

llSetColor(ON_COLOUR,ALL_SIDES);

llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, .2 ] ) ;



llSetTimerEvent(20);

}

}


collision_end(integer num)

{

count--;


if (count == 0)

{

llSetColor(OFF_COLOUR,ALL_SIDES);

llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, .0 ] ) ;

llSetTimerEvent(0);

}

}

}



Random Colors


integer toggle = 1; // This is our toggle switch for turning the

                    // script on and off.  You will never need to 

                    // change its value.


float base_delay = 1.0;  // This is the minimum amount of delay 

                         // that will happen between color changes.

                         // If you want a consistently longer or 

                         // shorter delay, change this value.


float variable_delay = 1.5;  // This is the maximum delay added to 

                             // the base_delay.  If you want a wider

                             // variation in the delay, then increase

                             // the value.  If you want less variance.

                             // then decrease it.


default

{

     state_entry() 

     {

          toggle *= -1;  // Here we multiply negative one, to change its 

                         // sign.


          if(toggle < 0) // We test to see if it is less than 0, and if it

                         // is, then we turn on the color changer.

          {

               llSetTimerEvent(llFrand(variable_delay) + base_delay);

          }

          else

          {

               llSetTimerEvent(0);

          }

     }


     timer()

     {

          llSetColor(<llFrand(1),llFrand(1),llFrand(1)>,ALL_SIDES);

          llSetTimerEvent(llFrand(variable_delay) + base_delay);

     }



SLIDESHOW



//global variables you may change

string texture1 = "Untitled-1_0000_bts_0000_Layer 16.jpg";//UUID of texture 1 (or inventory name if in inventorY)

string texture2= "Untitled-1_0001_bts_0001_Layer 15.jpg";//UUID of texture2

string texture3= "Untitled-1_0010_bts_0010_Layer 4.jpg";//UUID of texture3

string texture4= "Untitled-1_0012_bts_0012_Layer 2.jpg";//UUID of texture4

string texture5= "Untitled-1_0011_bts_0011_Layer 3.jpg";//UUID of texture5

string texture6= "Untitled-1_0006_bts_0006_Layer 8.jpg";//UUID of texture6

string texture7= "Untitled-1_0009_bts_0009_Layer 5.jpg";//UUID of texture7

string texture8= "Untitled-1_0008_bts_0008_Layer 6.jpg";//UUID of texture8

string texture9= "Untitled-1_0007_bts_0007_Layer 7.jpg";//UUID of texture9

string texture10= "Untitled-1_0005_bts_0005_Layer 9.jpg";//UUID of texture10

string texture11= "Untitled-1_0004_bts_0004_Layer 10.jpg";//UUID of texture11

string texture12= "Untitled-1_0003_bts_0003_Layer 11.jpg";//UUID of texture12

string texture13= "ply";//UUID of texture13

float time = 2.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;//switch states

    llSleep(2.0);

}

default

{

    touch_start(integer total_number)

    {

       

            switch(texture1);

 llSleep;

            switch(texture2);

 llSleep;

            switch(texture3);

 llSleep;

            switch(texture4);

 llSleep;

            switch(texture5);

 llSleep;

            switch(texture6);

 llSleep;

            switch(texture7);

 llSleep;

            switch(texture8);

 llSleep;

            switch(texture9);

 llSleep;

            switch(texture10);

 llSleep;

            switch(texture11);

             llSleep;

 llSleep;

            switch(texture12);

             llSleep;

             llSleep;

            

 llSleep;

             switch(texture13);

            

 llSleep;

    }

}




https://www.mrmonke.net/AniGifToLSL

Upload a .gif and export script/image