cubo che cambia colore e fa danzare l'avatar
 
//////
//    OK, so randBetween is from the llFrand page
//    we can use it to generate a random number from  minimum to maximum.
//    You will see how it works in the example below
//
//    and yes, I flip around with color and colour - in my comments its colour, in code, I concede to LL
integer playing;
         list dance = ["dance1", "dance2", "dance3"];
         float randBetween(float min, float max)
         {
         return llFrand(max - min) + min;
         }
//////
//  Colours are expressed in vectors. 
//  So, below gives us a basic random colour generator
vector randColor()
         { 
         return <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;    //sends back a message to whoever asks the random colour
         }
//////
//  Taking it one step further
//  So, below gives us a basic random colour generator
vector randVector()
         {
         // HERE we use the randBetween we have up on top to 
         // make a random number from 100 to 500 - on the Z axis. Fun for a trampoline :) 
         return <0,0,randBetween(100, 500)>; 
         }
default
         {
         state_entry() {
         playing = FALSE;
         llSetText("Clicca qui per farti un balletto...", <1.0,0,0>, 1.0); 
         llSetTimerEvent(30);
         }
 timer()
         {
   
         vector tempRandomColor = randColor();  //this loads temp ariable with random colur
         // llSay(0, (string)tempRandomColor );    //this says the vector, just to know its working
   
         llSetColor(tempRandomColor, ALL_SIDES); //set colour 
         // llPushObject( llDetectedKey(0), randVector(), ZERO_VECTOR, 0); // here we push the person who touched cube, 
         } 
 touch_start(integer start_param)
         {
 if(playing == FALSE)
         {
         llRequestPermissions(llDetectedKey(0),PERMISSION_TRIGGER_ANIMATION);
         }
         else if(playing == TRUE)
         {
         llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
         playing = FALSE;
         }
         }
   
         run_time_permissions(integer perm) 
         {
         if (perm & PERMISSION_TRIGGER_ANIMATION)
         {
         integer i;
         for (i=0;i<=2;i++)
         {
         //llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
         llStartAnimation(llList2String(dance, i));
         }
         }
         } 
     }