Picture Changer

Written by: Headmaster
integer i = 0;
integer numberofpics = 0;
list pics = [];

default
{
    state_entry()
    {
        numberofpics = llGetInventoryNumber(INVENTORY_TEXTURE);
        for (i = 0; i < numberofpics;){
            pics += [llGetInventoryName(INVENTORY_TEXTURE,i++)];
        }
        i = 0;
        llSetTexture(llList2String(pics,i++),ALL_SIDES);
        if (i >= numberofpics) {
            i = 0; 
        }  
    }
    touch_start(integer num_detected){
        llSetTexture(llList2String(pics,i++),ALL_SIDES);
        if (i >= numberofpics) {
            i = 0; 
        }
    }
}