Preloading Texture Displayer ( V1 )

Written by Kitsune

Use to display a texture to the public while displaying on a hidden face the next texture to display. Perfect for presentations that require a slideshow. Touch triggered, the textures will be displayed incrementally in alphabetical/numerical order. The script reads the textures from the inventory of the object and reacts only to the owners touch.

 

// V1 //
 
integer display_face = 0; // Face to display the texture on.
 
integer hidden_face = 1; // A face that is hidden that displays the texture to be preloaded to all local viewers.
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////NO NEED TO EDIT ANYTHING BELOW HERE///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
key owner;
 
integer tex;
 
integer noi;
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if(change & (CHANGED_INVENTORY | CHANGED_OWNER))
        llResetScript();
    }
    state_entry()
    {
        owner = llGetOwner();
        if((noi = llGetInventoryNumber(INVENTORY_TEXTURE)))
        {
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (tex = 0)), display_face);
            if(noi > 1)
            llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (++tex)), hidden_face);
        }
    }
    touch_start(integer nd)
    {
        while(nd)
        {
            if((llDetectedKey(--nd) == owner) && (noi > 1))
            {
                llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, tex), display_face);
                if((++tex) == noi)
                tex = 0;
                llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, tex), hidden_face);
            }
        }
    }
}