Simple slideshow projector

Another one from my series of LSL training courses.

Touches to switch to the next texture; resets if textures are added or removed to the inventory.

integer numberTextures = 0;
integer currentTexture = 0;

default
{
    state_entry()
    {
        numberTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
    }

    touch_start(integer who)
    {
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, currentTexture), ALL_SIDES);
        if (currentTexture < numberTextures -1)
            currentTexture++;
        else
            currentTexture = 0;
    }

    changed(integer what)
    {
        if (what & CHANGED_INVENTORY)
            llResetScript();
    }
}
Print Friendly, PDF & Email
%d bloggers like this: