Texture Vendor

Written by: Headmaster

You will need at least 3 prims for this project This script goes in the root prim:

integer price = 5; // price
float time = 0; // Enter a value if you want to auto scroll

string vendorname;
integer total;
integer counter;
integer change;

next()
{
    total=llGetInventoryNumber(INVENTORY_TEXTURE);
    vendorname = llGetObjectName();
    counter++;
    if(counter>=total)
    {
        counter=0;
    }
    llSetTexture(llGetInventoryName(INVENTORY_TEXTURE,    counter),ALL_SIDES);
    if (price > 0)
    {
        llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE,  counter) + "\n L$" + (string)price + "\n", <1,1,1>, 1);
    }
    else
    {
        llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE,  counter) + "\n Touch to recieve \n", <1,1,1>, 1);
    }
    llTriggerSound("Pressed", 1);
}
prev()
{
    total=llGetInventoryNumber(INVENTORY_TEXTURE);
    vendorname = llGetObjectName();
    if (counter > 0)
    {
        counter--;
    }
    else
    {
        counter=total - 1;
    }
    llSetTexture(llGetInventoryName(INVENTORY_TEXTURE,    counter),ALL_SIDES);
    if (price > 0)
    {
        llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE,  counter) + "\n L$" + (string)price + "\n", <1,1,1>, 1);
    }
    else
    {
        llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE,  counter) + "\n Touch to recieve \n", <1,1,1>, 1);
    }
    llTriggerSound("Pressed", 1);
}

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT  );
        next();
        llSetTimerEvent(time);
    }
    touch_start(integer total_number)
    {
        if ( llGetLinkName(llDetectedLinkNumber(0)) == "next" )
        {
            next();
        }
        else if ( llGetLinkName(llDetectedLinkNumber(0)) == "prev" )
        {
            prev();
        }
        else
        {
            if (price > 0)
            {
                llWhisper(0, "Pay L$" + (string)price + " to buy");
            }
            else
            {
                llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_TEXTURE,  counter));
            }
        }
    }
    timer()
    {
        next();
    }
    money(key giver, integer amount)
    {
        if (amount < price)
        {
            llSay(0, "Too little payed, refunding");
            llGiveMoney(giver, amount);
        }
        else if (amount > price)
        {
            change = amount - price;
            llSay(0, "Overpaid. vending item and giving L$" + (string)change + " change");
            llGiveMoney(giver, change);
            llGiveInventory(giver, llGetInventoryName(INVENTORY_TEXTURE,  counter));
            llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_TEXTURE,  counter) + " for L$" + (string)price);
        }
        else if (amount == price)
        {
            llGiveInventory(giver, llGetInventoryName(INVENTORY_TEXTURE,  counter));
        llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_TEXTURE,  counter) + " for L$" + (string)price);
        }
    }
    on_rez(integer start_param)
    {
        llResetScript();
    }
}

 name your back button 'prev' your forward button 'next' and link them to your root prim. drop your inventory and images in and your ready to go!