Rez a cube.
Drop script into it.
Drop some photos into the inventory of the prim.
It will cycle through the pictures every 30 seconds, or when you click on it.
If you damage the textures, just reset the script.
Have fun!
CODE
float time = 30.0;
integer DISPLAY_ON_SIDE = 5; //Change this to change where the image will be displayed
integer current_texture = 0; //Current texture number in inventory being displayed (picture mode)
key BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; //Blank texture - Used when there are no textures to display in Picture mode
pictures() //Change mode to Picture Viewer
{
//Change prim to Light material while coloring face 0 black to prevent light-lag generation.
vector height = llGetScale();
llSetPrimitiveParams([PRIM_BUMP_SHINY,DISPLAY_ON_SIDE,PRIM_SHINY_NONE,PRIM_BUMP_NONE,PRIM_COLOR,DISPLAY_ON_SIDE,<0,0,0>,1.0,PRIM_MATERIAL,PRIM_MATERIAL_LIGHT]);
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_SQUARE, <0.0, 1.0, 0.0>, 0.90, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, PRIM_SIZE, <height.x, height.x * 0.020, height.x * 0.720>]);
llSetColor(<0,0,0>,ALL_SIDES);
llSetColor(<1,1,1>,3);
llSetColor(<1,1,1>,5);
llSetTexture(BLANK,ALL_SIDES);
llSetTexture("3cb3fc81-b4dc-25c4-59e8-4be619d1fff6",3);
llScaleTexture(1, 1, ALL_SIDES);
llScaleTexture(-4.300, 1.100, DISPLAY_ON_SIDE);
llOffsetTexture(0.0, 0.0, ALL_SIDES);
llOffsetTexture(-0.650, 0.000, DISPLAY_ON_SIDE);
//Initilize variables
current_texture = 0;
//Set to first texture if available
integer check = llGetInventoryNumber(INVENTORY_TEXTURE);
if(check > 0)
display_texture(check);
else
{
llSetObjectDesc("No pictures found.");
llSetTexture(BLANK,DISPLAY_ON_SIDE);
}
}
display_texture(integer check) //Display texture and set name in description (picture mode)
{ //"Check" holds the number of textures in contents. The function uses "current_texture" to display.
string name = llGetInventoryName(INVENTORY_TEXTURE,current_texture);
//llSay(0,(string)llGetInventoryKey(name));
llSetTexture(name,DISPLAY_ON_SIDE);
llSetObjectDesc("Showing picture: "+name+" ("+(string)(current_texture+1)+"/"+(string)check+")");
}
next() //Change to next texture (picture mode)
{ //This function is used twice - by the menu and timer. Therefor, it is a dedicated function.
current_texture++;
integer check = llGetInventoryNumber(INVENTORY_TEXTURE);
if(check == 0)
{
llSetTexture(BLANK,DISPLAY_ON_SIDE);
current_texture = 0;
llSetObjectDesc("No pictures found.");
return;
}
if(check == current_texture)
current_texture = 0;
display_texture(check);
return;
}
default
{
state_entry()
{
pictures();
llSetTimerEvent(time);
}
touch_start(integer total_number)
{
llSetTimerEvent(0.1);
}
timer()
{
next(); //Next picture
llSetTimerEvent(time);
}
}