Who Is Online

3
Online

Monday, 19 November 2018 16:16

Single Prim Texture Changer

// Texture changer.  Will cycle through all textures
// in the prims inventory.
//
// Kimm Paulino
// Written for Bebelou Naidoo, April 2010
 
float TIMER_PERIOD = 5.0; // in seconds.
integer RANDOM = 1;     // 0 = sequential, 1 = random
 
// globals
integer gNumTextures;
integer gLastTexture;
 
default
{
    on_rez (integer n)
    {
        llResetScript();
    }
 
    state_entry()
    {
        gLastTexture = 0;
        gNumTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
        llSetTimerEvent(TIMER_PERIOD);
    }
 
    timer()
    {
        integer nextTexture;
        if (RANDOM)
        {
            // Randomly choose one
            nextTexture = (integer)llFrand (gNumTextures);
        }
        else
        {
            // Move on from the last one
            gLastTexture ++;
            if (gLastTexture > gNumTextures)
            {
                gLastTexture = 0;
            }
            nextTexture = gLastTexture;
        }
        string texture = llGetInventoryName(INVENTORY_TEXTURE, nextTexture);
        if (texture != "")
        {
            llSetTexture(texture, ALL_SIDES);
        }
    }
 
    changed (integer change)
    {
        if (change & CHANGED_INVENTORY)
        {
            llResetScript();
        }
    }
}

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool