LSLRandomColorCube
De HelpKit de Eva
Crea un cubo y añade un nuevo script siguiendo los pasos explicados. Luego copia y pega el siguiente:
// Random color script // This is our toggle switch for turning the script on and off. // You will never need to change its value. integer activated = FALSE; // This is the minimum amount of delay that will happen between color changes. float minimum_delay = 1.0; // This is the maximum delay added to the base_delay. float variable_delay = 1.5; // This global function sets the text that appears above the object in white color, fully opaque. reLabel(string labelText) { llSetText(labelText,<1.0, 1.0, 1.0>, 1.0); } default { state_entry() { // set a label when the script starts running reLabel("Click to Start"); } touch_start(integer counter) { // Check if the person detected touching is the owner of the object if(llDetectedKey(0) != llGetOwner()) { // If toucher is not the owner, send him or her a private message llInstantMessage(llDetectedKey(0),"Only my owner can start or stop me"); // exit this event handler return; } if(activated == FALSE) { // generate a random number, lasting at least minimum delay float interval_seconds = llFrand(variable_delay) + minimum_delay; // create a timer interval to call the timer() event handler every interval_seconds llSetTimerEvent(interval_seconds); activated = TRUE; // Change our label reLabel("Click to Stop"); } else { // disable the timer cycle llSetTimerEvent(0); activated = FALSE; // Change our label reLabel("Click to Start"); } } timer() { // set a random R,G,B color to all sides llSetColor(<llFrand(1),llFrand(1),llFrand(1)>,ALL_SIDES); // re-set the timer to a new interval llSetTimerEvent(llFrand(variable_delay) + minimum_delay); } }

