Friday, April 13, 2007

Picture Viewer

Super easy item to make is a Picture Viewer.







<~ Me! at New Years







A Picture Viewer is like an online photo album of all your SL photos or movies if you prefer.

First Rezzed a Cube as this:
X 2.093
Y 4.300
Z .600
Measurements and hollowed it out to 95% this was our frame.
With a Rotation of Y: 270
<~~ Frame!







Stretch it because I wanted the big super plasma TV look going on. Then changed the taper

X .15
Y .10

Then Rezzed another Cube
X 0.071
Y 3.772
Z 1.758
and fit that to the back of the frame with that as if it were the canvas.
The texture on this has to be set to all ones, if not then you get multipule pictures on the canvas. (kinda like how a Fly sees things)
Horizontal (U) .140
Veritcal (V) 7.900
Repeats per Meter 2

<~~ Canvas!......boy am I excited?









This Prim (canvas) is where I put the script in that holds the pictures.

Select the canvas Prim and in the More button on the Edit box go to Content Tab and add this script.
(Pre prep) First you need to make the script note card. One of two ways, Click the "Add script" in the Contents Tab or Go to your Inventory and at the top menu is a "Create" Tab. Click that and "New Script". A small note box will appear with a script already in there. Delete that script that loads inside and copy and paste this one:
key ownerkey;

string tvname = "JacksTV";

integer numberitems = 0;
integer selected = 1;

integer storelisten = 0;

float r=1.0;
float g=1.0;
float b=1.0;

integer switchtime = 15;

updatetext()
{
if(r==-1)
llSetText("",<0,0,0>,100);
else
llSetText(llGetInventoryName(INVENTORY_TEXTURE,( selected - 1))+
"\nPicture "+(string)selected+" of "+(string)numberitems, <r,g,b>, 1.5);

llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, (selected - 1)),ALL_SIDES);
}


Init()
{
ownerkey = llGetOwner();
llInstantMessage(ownerkey,"JacksTV script reset!");
numberitems = llGetInventoryNumber(INVENTORY_TEXTURE);
updatetext();

llListenRemove(storelisten);
storelisten = llListen(0,"",ownerkey,"");

}

switchpic()
{
selected++;
if (selected > numberitems)
selected = selected - numberitems;
updatetext();

}


default
{
state_entry()
{
Init();
llSetTimerEvent(switchtime);
}

on_rez(integer param)
{
Init();
llSetTimerEvent(switchtime);

}

listen(integer channel, string name, key id, string msg)
{
list command = llParseString2List(msg,[":"],[]);
if(llList2String(command,0)==tvname)
// ALL COMMANDS MUST START WITH THE TVNAME
{
string whichcommand=llList2String(command,1);
if(whichcommand=="setname")
{
string newname=llList2String(command,2);
if(newname!="")
{
llSay(0,"JacksTV '"+tvname+"' has been renamed: '"+newname+"'.");
tvname=newname;

}
else
{
llSay(0,"Sorry, you must enter a name for your vendor. Please try again.");
}
}
else if(whichcommand == "setcolor")
{
list colors = llParseString2List(llList2String(command,2),[","],[]);
r = (float)(llList2String(colors,0));
if(r != -1)
{
r = r / 255;
}
g = ((float)(llList2String(colors,1))/255);
b = ((float)(llList2String(colors,2))/255);
updatetext();
}
else if(whichcommand == "settimer")
{
switchtime = (integer)llList2String(command,2);
llInstantMessage(ownerkey,"JacksTV will now switch every "+(string)switchtime+" seconds.");
llSetTimerEvent(switchtime);
}
else if(whichcommand == "reset")
{
llResetScript();
}
}
else
if(llList2String(command,0)=="GetJacksTVName")
{
llSay(0,"My name is: "+tvname);
}
} // end listen

touch( integer n)
{
// llSay(0,"changing");
switchpic();
}

timer()
{
switchpic();
}

}



Then click the "Save" button at the bottom of the note box and wait for the script to compile.
When you see "Compile Successful"! Close the note and rename it something you will recognize (TV Viewer).
Slide that note from your inventory into the "Contents" Tab of the back portion of the Canvas Prim. That is if you chose to open a script in your inventory, other wise its already in you Contents Tab.
Then do the same with those really cool pictures people send you in SL. You slide those over into the contents Tab along with the new script you copied and pasted. (Canvas prim)
I did the select all trick and linked the 2 Prims together (Frame and Canvas).
Close the Edit box out and click the viewer to activate it and enjoy the show.
Later, I chose a mahogany texture to it just to give it an elegant look I did a few in metallic as well.

Handy tip: Before you add the pictures to the viewer -- rename them. Say, if you have a picture of you and your best mate. Rename them like “Me and Jimmy Jo Bob” or whatever, this way whoever watches the slide show will know who they are viewing or what the object it is.


1 comment: