Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

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
Discussion Thread
11-24-2004 19:44
/54/f8/61651/1.html
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.
SirSticky Hornpipe
Registered User
Join date: 24 Jun 2005
Posts: 43
increasing the frame rate.
08-05-2006 06:59
Ive attempeted to run this script at a fast frame rate , what i really want is it to run smoothly, more like an animation.
At the fastest slide rate it still seems jerky
Have i the wrong type of script to achieve that , if so could you direct me as to where i can find the correct one TY
Azadine Umarov
Registered User
Join date: 7 Apr 2007
Posts: 31
06-01-2007 00:16
From: SirSticky Hornpipe
Ive attempeted to run this script at a fast frame rate , what i really want is it to run smoothly, more like an animation.


Only a guess, but I'd say you might get a higher frame rate if you coded it custom and used key ids for all frames of the animation? Perhaps a notecard containing each key id would also do it? You might also try to simulate page flipping. That is load multiple images to dark or invisible prims or surfaces, and have the script swap in each new image as needed?
Lisa Huet
Registered User
Join date: 24 Feb 2007
Posts: 38
07-09-2007 05:03
Love the script, but agree a really bad move in terms of lag.

I'd love to use this script but i'm no scripter and can't seem to figure out which bits to change to get it working on another channel :(

Could someone who knows about this stuff maybe adapt it for like channel 12 or something and repost?
Petteri Yiyuan
Registered User
Join date: 4 Mar 2007
Posts: 56
04-17-2008 02:27
From: FlipperPA Peregrine
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

So this script can still whisper instructions to channel 0 just change it to listen channel 1 and issue commands to it in channel 1?

This discussion about listening channel 0 brought one issue about lag and channels made me think one thing. I attend many times to sword tournament where tournament sword is provited. One most used sword listens draw/sheath commands in channel 0 and all participants are using it. Could it be one contributor of lag since everytime something is said in channel 0 everyones sword script is checking it?