Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Picture Display/Slideshow Board

Cienna Rand
Inside Joke
Join date: 20 Sep 2003
Posts: 489
10-28-2004 17:04
This behaves similarly to the Stage 4 board. Built in support for back/next, timed slideshow mode, purge of contents (owner only), and optional display of the snapshot name over the prim. As written it is meant to be dropped onto a single prim, it will color the faces to denote which one will be displaying pictures (blank white face).

Back and next encapsulated as functions for easy outside control (such as via link message). Please feel free to build on this for commercial/non-commercial usage as long as attribution is retained.

CODE

// PictureBoard Script
// Display pictures from any user via ctrl-drag onto object.
// Original script by Cienna Rand
// Creative Commons - Attribution
// http://creativecommons.org/licenses/by/1.0/
// v1.7 - Change to use key to universal blank texture

// Chat commands:
// next : advance to next picture
// back : go back to previous picture
// slide N : advance automatically every N seconds (slideshow)
// slide 0 : stop slideshow mode
// purge : (owner only) purge dropped textures from inventory of board

// Config Items
// If TRUE, show name of image above the board, FALSE for no name
integer showText = TRUE;
// If showText is TRUE, text shown will be in this color
vector textColor = <1,1,1>;

// SCRIPT BEGINS - Do not modify unless you know what you're doing //
integer curr = 0;
list contents = [];
string BLANK_TEXTURE = "5748decc-f629-461c-9a36-a35a221fe21f";

setText(string text)
{
if (showText)
llSetText(text, textColor, 1.0);
}

purge()
{
integer i = 0;
integer n = llGetInventoryNumber(INVENTORY_TEXTURE);
while (n > i)
{
string name = llGetInventoryName(INVENTORY_TEXTURE, i);
if (name != "Blank")
llRemoveInventory(name);
else
i++;
n = llGetInventoryNumber(INVENTORY_TEXTURE);
}
curr = 0;
contents = [];
llSetTexture(BLANK_TEXTURE,1);
llSetText("", <1,1,1>, 1.0);
}

back()
{
if (curr == 0) curr = llGetListLength(contents) - 1;
else curr--;

setText(llList2String(contents, curr));
llSetTexture(llList2String(contents, curr), 1);
}

next()
{
if (curr == llGetListLength(contents) - 1) curr = 0;
else curr++;

setText(llList2String(contents, curr));
llSetTexture(llList2String(contents, curr), 1);
}

help()
{
llWhisper(0, "Say 'next' to advance to the next picture.");
llWhisper(0, "Say 'back' to go back to the previous picture.");
llWhisper(0, "Say 'slide N' to automatically advance every N seconds (ex: slide 5)");
llWhisper(0, "Say 'slide 0' to stop slide show mode.");
llWhisper(0, "Owner only: say 'purge' to clear textures from board's inventory.");
}

default
{
state_entry()
{
purge();
llListen(0, "", "", "");
llAllowInventoryDrop(TRUE);
llSetColor(<0.2,0.2,0.2>, ALL_SIDES);
llSetColor(<1,1,1>, 1);
}

on_rez(integer param)
{
llWhisper(0, "Say 'help' for commands.");
}

changed(integer change)
{
if ((change & CHANGED_INVENTORY) || (change & CHANGED_ALLOWED_DROP))
{
integer count = llGetInventoryNumber(INVENTORY_TEXTURE);
if (count > llGetListLength(contents)) // New Texture
{
integer i;
for (i = 0; i < count; i++)
{
string name = llGetInventoryName(INVENTORY_TEXTURE, i);
if (llListFindList(contents, [name]) == -1)
{
contents += name;
jump break;
}
}
@break;
curr = llGetListLength(contents) - 1;
string name = llList2String(contents, -1);
setText(name);
llSetTexture(name, 1);
}
}
}

listen(integer channel, string name, key id, string msg)
{
if (id == llGetOwner() && msg == "purge")
{
llWhisper(0, "Purging textures from my inventory.");
purge();
}
else if (msg == "back")
{
back();
}
else if (msg == "next")
{
next();
}
else if (msg == "help")
{
help();
}
else if (llGetSubString(msg, 0, 4) == "slide")
{
llSetTimerEvent((float)llGetSubString(msg, 6,-1));
}
}

timer()
{
next();
}
}
_____________________
You can't spell have traffic without FIC.
Primcrafters (Mocha 180,90) : Fine eyewear for all avatars
SLOPCO (Barcola 180, 180) : Second Life Oil & Petroleum
Company
Landmarker : Social landmarking software
Conversation : Coming soon!
Prokofy Neva
Virtualtor
Join date: 28 Sep 2004
Posts: 3,698
Original Thread
11-24-2004 19:44
/15/91/25943/1.html


Couldn't get it to work
------------------------------
I couldn't get this to work, and I'd like to. It could be because I'm a clueless newb.

I cut and pasted your script, and I made a simple prim board. I opened up contents, opened up "new script," popped in your script. It said "Syntax error" on line 49 I think. I then tried to see if the face you described would turn white or if anything would happen -- it didn't.

Perhaps you could supply step-by-step description.
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
11-29-2004 23:58
From: someone

llListen(0, "", "", "";);

I strongly recommend that you never ever ever ever ever use an open listen like this. This creates major lag in a crowded setting. One of the filters should be use so that this is not constantly firing off.
_____________________
Hiro Pendragon
------------------
http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio

Visit my SL blog: http://secondtense.blogspot.com
Wayfinder Wishbringer
Elf Clan / ElvenMyst
Join date: 28 Oct 2004
Posts: 1,483
12-17-2004 23:36
What listen line should be used instead?

-- Enquiring minds want to know. LOL
_____________________
Visit ElvenMyst, home of Elf Clan, one of Second Life's oldest and most popular fantasy groups. Visit Dwagonville, home of the Dwagons, our highly detailed Star Trek exhibit, the Warhammer 40k Arena, the Elf Clan Museum and of course, the Elf Clan Fantasy Market. We welcome all visitors. : )
FlipperPA Peregrine
Magically Delicious!
Join date: 14 Nov 2003
Posts: 3,703
03-18-2005 12:38
llListen(1,"","","";) would be much better.

Any time a listen is on channel 0 with no other restrictions, it becomes a major lag creator. Any time anyone speaks within 20 some odd meters, or shouts within 96 meters, the script is called to run on the server. It must then parse through the login in the listen event. As channel 0 is constantly used by public chat, this is just silly. By putting it on channel 1 - or any other channel - that code will only be executed any time someone specifically issues a command on that channel by preceeding it with a "/1" in their chat entry box. Thus, the code would then only be executed whenever chat is seen on the non-public channel chosen.

I hope this explains it.

Regards,

-Flip
_____________________
Peregrine Salon: www.PeregrineSalon.com - my consulting company
Second Blogger: www.SecondBlogger.com - free, fully integrated Second Life blogging for all avatars!
Cartman Ludd
I'm with stupid ---->
Join date: 25 Mar 2005
Posts: 11
03-31-2005 00:25
I would love to use this, but I can't get it to work. If you could tell us step by step how to do it, then it would be much easier.
_____________________
Siggy's are stupid. 'Hey, look! Its that really random signature that I have had to read for the last 6 weeks, because that darn person is to defective to change it!' If this is you, I think we should get our freakin' panzerfrausts and blow every signature on this forum to kingdom come. Thank you for ignoring my signature, and if you went through painstaking process of reading it, then either you have to much time on your hands, or you have the I.Q of the slug.
Caoimhe Armitage
Script Witch
Join date: 7 Sep 2004
Posts: 117
04-16-2005 21:24
From: FlipperPA Peregrine
llListen(1,"","","";) would be much better.
...
I hope this explains it.


It does and I completely agree with you, but it is very user-unfriendly. What we *need* is regexs in the match param...

- C
Derry McTeague
Registered User
Join date: 6 Jan 2005
Posts: 81
Help
09-09-2005 03:06
i couldnt get this script to work withr please let me know if this script has to be altered in any(other than the Channel it listens on). Im not a cripter, but i copied the script and created a new sctipt, dropped it in a prim and it didnt work, kept saying couldnt find pictures.
Play Ball
Registered User
Join date: 6 Oct 2006
Posts: 1
how to use
02-26-2007 02:17
I've pasted the code and edited the listner line. However, i don't know where i need to define the images that make up the slideshow. Or in a simple way of saying this. How can i get this thing to work with my images?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-26-2007 04:54
From: Play Ball
I've pasted the code and edited the listner line. However, i don't know where i need to define the images that make up the slideshow. Or in a simple way of saying this. How can i get this thing to work with my images?



The code is written such that it will iterate through any textures dropped into the object.
BigRedWood Fapp
Red Hot Ink Tattoos
Join date: 20 Jan 2007
Posts: 30
works fine
02-28-2007 02:21
I simply changed the listen to channel 1, dropped the script onto a prim, then dropped a texture on it. Started working right away. Good job!
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
02-28-2007 04:38
CODE

// PictureBoard Script
// Display pictures from any user via ctrl-drag onto object.
// Original script by Cienna Rand
// Creative Commons - Attribution
// http://creativecommons.org/licenses/by/1.0/
// v1.7 - Change to use key to universal blank texture

// Chat commands:
// next : advance to next picture
// back : go back to previous picture
// slide N : advance automatically every N seconds (slideshow)
// slide 0 : stop slideshow mode
// purge : (owner only) purge dropped textures from inventory of board

// Config Items
// If TRUE, show name of image above the board, FALSE for no name
integer showText = FALSE;
// If showText is TRUE, text shown will be in this color
vector textColor = <1,1,1>;

// SCRIPT BEGINS - Do not modify unless you know what you're doing //
integer curr = 0;
list contents = [];
string BLANK_TEXTURE = "8bf1bfc2-66cf-f947-072f-04a5f76624f6";


purge()
{
integer i = 0;
integer n = llGetInventoryNumber(INVENTORY_TEXTURE);
while (n > i)
{
string name = llGetInventoryName(INVENTORY_TEXTURE, i);
if (name != "Blank")
llRemoveInventory(name);
else
i++;
n = llGetInventoryNumber(INVENTORY_TEXTURE);
}
curr = 0;
contents = [];
llSetTexture(BLANK_TEXTURE,0);
llSetText("", <1,1,1>, 1.0);
}

back()
{
if (curr == 0) curr = llGetListLength(contents) - 1;
else curr--;


llSetTexture(llList2String(contents, curr), 0);
}

next()
{
if (curr == llGetListLength(contents) - 1) curr = 0;
else curr++;


llSetTexture(llList2String(contents, curr), 0);
}

help()
{
llWhisper(0, "Say '/7 next' to advance to the next picture.");
llWhisper(0, "Say '/7 back' to go back to the previous picture.");
llWhisper(0, "Say '/7 slide N' to automatically advance every N seconds (ex: slide 5)");
llWhisper(0, "Say '/7 slide 0' to stop slide show mode.");
llWhisper(0, "/7 Owner only: say 'purge' to clear textures from board's inventory.");
}

default
{
state_entry()
{
purge();
llListen(7, "", "", "");
llAllowInventoryDrop(TRUE);
llSetColor(<0.2,0.2,0.2>, 0);
llSetColor(<1,1,1>, 0);
}

on_rez(integer param)
{
llWhisper(0, "Say '/7 help' for commands.");
}

changed(integer change)
{
if ((change & CHANGED_INVENTORY) || (change & CHANGED_ALLOWED_DROP))
{
integer count = llGetInventoryNumber(INVENTORY_TEXTURE);
if (count > llGetListLength(contents)) // New Texture
{
integer i;
for (i = 0; i < count; i++)
{
string name = llGetInventoryName(INVENTORY_TEXTURE, i);
if (llListFindList(contents, [name]) == -1)
{
contents += name;
jump break;
}
}
@break;
curr = llGetListLength(contents) - 1;
string name = llList2String(contents, -1);

llSetTexture(name, 0);
}
}
}

listen(integer channel, string name, key id, string msg)
{
if (id == llGetOwner() && msg == "purge")
{
llWhisper(0, "Purging textures from my inventory.");
purge();
}
else if (msg == "back")
{
back();
}
else if (msg == "next")
{
next();
}
else if (msg == "help")
{
help();
}
else if (llGetSubString(msg, 0, 4) == "slide")
{
llSetTimerEvent((float)llGetSubString(msg, 6,-1));
}
}

timer()
{
next();
}
}

OOZ Katscher
Registered User
Join date: 9 Feb 2007
Posts: 1
05-23-2007 01:42
is it also possible to add buttons so users/visitors can control the slideshow?

if so, can anyone show or tell how?

Thanks in advance
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-23-2007 02:15
From: OOZ Katscher
is it also possible to add buttons so users/visitors can control the slideshow?

if so, can anyone show or tell how?

Thanks in advance


As was said in the OP next and back are encapsulated to allow control through linked Messages or directly through chat.
_____________________
I'm back......
Aragorn Schism
Registered User
Join date: 1 Nov 2007
Posts: 42
01-12-2008 09:41
I stumbled on this post while searching on how to use PictureBoard 2.0. I started reading the script. I know nothing about scripting. I see in there some wording suggesting that showing picture titles will be displayed if "name of image above board" is TRUE.

Simple question. I think this is the script running PictureBoard 2.0. How do I not show the name of the image above the board? It does not list a command to accomplish that. Thanks.
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
01-12-2008 10:48
You are correct in your reading of the script, however, no command exists in the script to change the value from TRUE.

You would have to modify the code either to initialises the global variable: integer showText = FALSE;
...in which case the text will be permanently off.


or add the functionality to the listen(integer channel, string name, key id, string msg) event handler:

else if (msg == "text";)
{
showText = !showText;
if (showText) setText(llList2String(contents, curr));
else llSetText("", <1,1,1>, 1.0);
}

...in which case you could toggle the text with the command: text


In any event you will have to be able to modify the script's code in whatever product you are using.

According to the comments in the code it is: PictureBoard v1.7