Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Free Photo Viewer Script

Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
10-31-2004 17:02
Okay, a friend of mine had a broken picture viewer, so I made my own "HiroTV".

Below is the notecard instructions and then followed by the source code. This is freeware, not supported, please have fun with it! =)

======== HiroTV ========
- easy, low-lag picture display script.
Freeware by Hiro Pendragon
----------------------------------------

Table of Contents:
1. Setup
2. Commands
3. Frequently Asked Questions
-----------------

1. SETUP

Step 1: Drop the HiroTV script into any prim you'd like to display pictures on.
Step 2: Add pictures.
Step 3: say, "HiroTV:reset"

-------------------------

2. COMMANDS

NOTE: All commands are case sensitive

HiroTV:setname
--------
Changes the name your HiroTV responds to. This is useful if you have more than one up in a room.
For example -
HiroTV:setname:MyTV
changes the name to "MyTV". All commands now will begin with "MyTV" instead of "HiroTV".

GetHiroTVName
--------
If you've forgotten the name of your HiroTV, you can use this command and any HiroTV in range that you
own will tell you its name.

HiroTV:setcolor
--------
Changes the color of the floating text, using 0-255 values for Red, Green, and Blue.
Example -
HiroTV:setcolor:255,255,255
changes the floating text to white.
HiroTV:setcolor:255,0,255
changes the floating text to magenta
HiroTV:setcolor:-1
turns off the floating text. You can turn it on again by simply doing the setcolor command with what color you want.

HiroTV:settimer
--------
Changes how many seconds between change of picture
Example -
HiroTV:settimer:10
changes the time between display to 10 seconds

-----------------------

3. Frequently Asked Questions

Q: It won't let me add pictures!
A: Make sure you are: (a) adding them to the Content folder of the TV (b) Not trying to add the pictures while the picture changes.

Q: How do I make the pictures stop changing!
A: HiroTV:settimer:0

Q: I added pictures but why won't they display?
A: HiroTV:reset

Q: Can I modify HiroTV?
A: Yes, it's open source freeware. Please do not delete any comments from the code if you modify. Thanks!

Q: Can I resell HiroTV or modified HiroTV?
A: No, please keep this freeware.

Q: Does the creator offer help with this product?
A: No. Play at your own risk.

Have fun!

CODE
key ownerkey;

string tvname = "HiroTV";

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,"HiroTV 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,"HiroTV '"+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,"HiroTV will now switch every "+(string)switchtime+" seconds.");
llSetTimerEvent(switchtime);
}
else if(whichcommand == "reset")
{
llResetScript();
}
}
else
if(llList2String(command,0)=="GetHiroTVName")
{
llSay(0,"My name is: "+tvname);
}
} // end listen

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

timer()
{
switchpic();
}

}
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Sensual Casanova
Spoiled Brat
Join date: 28 Feb 2004
Posts: 4,807
11-05-2004 17:50
Original Thread
/15/0e/26151/1.html


Is this the same thing thats in those avalon phones?
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
11-11-2004 11:57
Sorta kinda. But:
(a) You can use it in any prim, not just a tiny screen.
(b) It's freeware. Have fun.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Prokofy Neva
Virtualtor
Join date: 28 Sep 2004
Posts: 3,698
Great!
11-25-2004 08:46
I loved this device and it worked fine after I fixed what seemed to be "syntax errors" -- the separation of the word 'selected' in one place and removal of the line at the end. If you follow the directions precisely it should work and it's a great thing for events because it makes a slideshow that you can leave running with 2 or 10 or more seconds between shots.
Buck Spinnaker
Entrepreneur
Join date: 26 Aug 2004
Posts: 57
Hiro TV
02-26-2005 16:28
Does this random pick or take pics next in line?
Aidoy Edelbrock
Registered User
Join date: 12 Feb 2005
Posts: 4
03-06-2005 11:26
didnt work fo rme and did excatly what the directions where :(
Aleksie Solvang
nani?
Join date: 21 Oct 2004
Posts: 113
04-07-2005 10:42
yay thanks Hiro - it worked perfectly :D
Zante Zapedzki
We need html on a prim!
Join date: 15 Feb 2007
Posts: 123
03-30-2007 05:30
How would one add buttons to this?

So as to cycle through the images I mean : )
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
04-09-2007 05:16
/54/f5/176347/1.html
_____________________
i've got nothing. ;)