Public feed #890693

Something

public text v1 · immutable
Raw Edit
·published 2008-02-03 23:25 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.
string FORWARD = "forward_button";
string BACK = "back_button";

default
{
    state_entry()
    {
        gListLength = llGetInventoryNumber(INVENTORY_TEXTURE);
    }
    link_message(integer sender_num, integer num, string str, key id)
    {
        string lLinkName = llGetLinkName(sender_num);

        if (lLinkName == 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 (lLinkName == 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);
    }
}