Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Simple Powerpoint-Like Presentation Script

Lum Pfohl
Registered User
Join date: 14 May 2007
Posts: 7
03-21-2008 12:12
Giving back to the community:

This is my script for an in-world slide show (like a simple powerpoint).

1) Rez a cube and fill it with textures followed by this script. If the textures are named to be sequential or in lexicographical order, this script will display each texture in that order.

2) Change the cube into a presentation panel as follows
TaperX 0.10
TaperY 0.10
SizeX 2.5
SizeY 5.0
SizeZ 0.1
Apply Black Color to Faces 1, 2, 3, 4 & 5.
Do not apply any color to Face 0

3) Textures will be displayed on Face 0, and the next texture will be displayed on Face 1. Apply Black Color to Face 1, but do not color Face 0

4) Drop the script into the panel.

5) Touch the cube (now a framed panel) to start. A drop down menu will provide options to go back, go forwards in the sequence of textures, or reset the presentation.

From: someone
//
// LumVision-Presentation Script v 0.2
//
// Written by Lum Pfohl December 11, 2007
//
// January 02, 2008 - Added code to precache the next texture after a short time delay


// set to TRUE if you want debug messages written to chat screen
integer __debug = FALSE;
string __version_id = "LumVision-Presentation Script v 0.2";

// global variables
integer interval;
integer currentTexture = 0;
integer previousTexture = 0;
integer totalTextures = 0;
list textureList =[];
integer messageChannel = 999888;
list dynMenu =["Back", "Version", "Forward", "Reset"];

// this is a list of all the possible inventory types, as constants.
list list_types = [INVENTORY_NONE, INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_LANDMARK,
INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD, INVENTORY_SCRIPT,
INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE];

// this list is of the string names corresponding to the one above.
list list_names = ["None", "Texture", "Sound", "Landmark", "Clothing", "Object", "Notecard",
"Script", "Body Part", "Animation", "Gesture"];

default {
state_entry() {

// read in the textures in the prim and store it
integer typeCount = llGetInventoryNumber(INVENTORY_TEXTURE);

integer j;

for (j = 0; j < typeCount; ++j) {
string invName = llGetInventoryName(INVENTORY_TEXTURE, j);
if (__debug) {
llWhisper(0, "Inventory " + invName);
}
textureList += invName;
++totalTextures;
}

if (__debug) {
llWhisper(0, "Found " + (string) totalTextures + " textures";);
}

llSetTexture(llList2String(textureList, 0), 0);


// initialize the channel on which the vendor will talk to the owner via dialog
messageChannel = (integer) llFrand(2000000000.0);
llListen(messageChannel, "", NULL_KEY, "";);
// llOwnerSay((string)messageChannel);
currentTexture = 0;
}

on_rez(integer start_param) {
llResetScript();
}


touch_start(integer total_number) {

if (llDetectedKey(0) == llGetOwner()) {
llDialog(llDetectedKey(0), "What do you want to do?", dynMenu, messageChannel);
}

}

// listen for for dialog box messages and respond to them as appropriate

listen(integer channel, string name, key id, string message) {

if (id != llGetOwner()) {
return;
}

if (message == "Version";) {
llWhisper(0, __version_id);
return;
}

if (message == "Reset";) {
llResetScript();
}

if (message == "Back" && currentTexture > 0) {
previousTexture = currentTexture;
--currentTexture;
} else if (message == "Forward" && (currentTexture >= 0) && (currentTexture < totalTextures)) {
previousTexture = currentTexture;
++currentTexture;

} else {
llDialog(llGetOwner(), "What do you want to do?", dynMenu, messageChannel);
return;
}

// If there are textures to apply, do so now. Otherwise - quietly
// do nothing.
if (totalTextures > 0) {

// Ensure that we do not go out of bounds with the index
if (currentTexture >= totalTextures) {
currentTexture = 0;
}
// Set the new prim texture
llSetTexture(llList2String(textureList, currentTexture), 0);

// set up so that in 3 seconds, we display the next image on a different face (hidden)
llSetTimerEvent(3.00);

llDialog(llGetOwner(), "What do you want to do?", dynMenu, messageChannel);
}
}

timer() {
// Cancel any further timer events
llSetTimerEvent(0.00);

// set the next texture (as a pre-cache) on the reverse face
integer nextTexture = currentTexture + 1;
if (nextTexture >= totalTextures) {
nextTexture = 0;
}
llSetTexture(llList2String(textureList, nextTexture), 1);
}

}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
03-28-2008 07:37
:-)
_____________________
i've got nothing. ;)
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
03-28-2008 16:22
Hell yeah...Bumpety bump...just what I wanted...Lum you are a star
_____________________
Tread softly upon the Earth for you walk on my face.
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
!!!!!!
03-29-2008 13:32
Very nice. Just what I was looking for. I like the fact that it is one prim
Wam7c Macchi
Registered User
Join date: 29 Nov 2007
Posts: 1
Great script
04-18-2008 05:12
I love this script. It is incredibly useful. Thanks, Lum!
Davin Romano
jerk
Join date: 21 Mar 2008
Posts: 384
05-03-2008 22:02
Can anyone IM me a place i can see one of these in action?
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
05-12-2008 04:30
Just a little code to automate the set up of this.

CODE

//////////////////////////////////////////
//Set Up Script for //
//LumVision-Presentation Script v 0.2 //
// //
//Written by Django Yifu 12/05/08 //
//////////////////////////////////////////


default
{
state_entry()
{
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.90, 0.90, 0.0>, <0.0, 0.0, 0.0>, PRIM_SIZE, <2.5, 5.0, 0.1>, PRIM_COLOR, 1, <0.0,0.0,0.0>, 1.0,PRIM_COLOR, 2, <0.0,0.0,0.0>, 1.0,PRIM_COLOR, 3, <0.0,0.0,0.0>, 1.0,PRIM_COLOR, 4, <0.0,0.0,0.0>, 1.0,PRIM_COLOR, 5, <0.0,0.0,0.0>, 1.0]);
}
}
[\php]
_____________________
Tread softly upon the Earth for you walk on my face.
Breen Mathy
Registered User
Join date: 21 Aug 2008
Posts: 1
10-07-2008 17:03
Thank you very much for this brilliant script. I built a simple presentation board and put your script in, (along with your comments and name) and it worked brilliantly.