All pastes #885671 Raw Edit

Console A

public text v1 · immutable
#885671 ·published 2008-01-31 01:24 UTC
rendered paste body
integer gListPos = 0;    //an integer to track current list position.
integer gListLength = 0;  //number of snapshots found.
string gCurrentSnap = "Snap01";    //a string, to be converted to from ListPos, relating to the name of each snapshot.
integer CONSOLE_CHAN = -6667;

default
{
    state_entry()
    {
        gListLength = llGetInventoryNumber(INVENTORY_TEXTURE);
        llListen(CONSOLE_CHAN, "", NULL_KEY, "");
    }
    listen( integer channel, string name, key id, string message )
    {
        if (message == "forward")
        {
            if (gListPos == (gListLength - 1))    //Branch to reset ListPos to 0 when it hits the end of the list.
            {
                gListPos = 0;
            }
            else 
            {
                ++gListPos;    //increment on touch, to move through the snapshots.
            }
        }
        else if (message == "back")
        {
           if (gListPos == 0)    //Branch to reset ListPos to max when it hits the bottom of the list.
            {
                gListPos = (gListLength - 1);
            }
            else 
            {
                --gListPos;    //decrement on touch, to move through the snapshots.
            }
        }
        gCurrentSnap = llGetInventoryName(INVENTORY_TEXTURE, gListPos);    //Pulling the string name of current snapshot from the list for use in llSetTexture.
        llSetTexture(gCurrentSnap, ALL_SIDES);  //Setting snapshot!
        llSay(PUBLIC_CHANNEL, "Displaying picture " + (string)(gListPos + 1) + "/" + (string)gListLength);
    }
}