Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Presenter Presenter_with_Timer  

Presenter_with_Timer

Presenter_with_Timer

Category: Presenter
By : Paul Preibisch
Created: 2013-03-28 Edited: 2013-03-28
Worlds: Second Life

the Zip file

Download all files for Presenter_with_Timer
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Presenter_with_Timer_1.lsl
1 /*
2 *
3 * Copyright (c) 2013 contributors (see below)
4 * Released under the GNU GPL v3
5 * -------------------------------------------
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * All scripts must maintain this copyrite information, including the contributer information listed
21 *
22 * As mentioned, this script has been licensed under GPL 3.0
23 * Basically, that means, you are free to use the script, commercially etc, but if you include
24 * it in your objects, you must make the source viewable to the person you are distributuing it to -
25 * ie: it can not be closed source - GPL 3.0 means - you must make it open!
26 * This is so that others can modify it and contribute back to the community.
27 *
28 * Enjoy!
29 *
30 * This script can be found on git hub: https://github.com/firecentaur/lsl-scripts
31 *
32 * Contributors:
33 * Paul Preibisch (fire@b3dmultitech.com)
34 *
35 * DESCRIPTION
36 *
37 * Hi everyone, I hope this script helps you for your Virtual World Presentations!
38 * To use, simply place this script into an Opensim Primitive Object, along with your textures.
39 *
40 * Once clicked, you will get a menu that allows you to:
41 *
42 * RESET - resets the scripts
43 * Set Timer - Set a timer (in seconds) and start the timer to automatically advance the slides
44 * Start Timer - Start the timer if it is stopped
45 * Stop Timer - Stop the timer if it is currently started
46 * Next - advance to next slide
47 * Previous - go to previous slide
48 * lock/unlock - lock/unlock the presenter so only the owner can use
49 * Messages on / Messags off - turn messages on or off to give textual feedback to all users when moving to a new slide etc
50 *
51 */
52
53 list textures;
54 integer total_items;
55 integer random_integer ( integer min , integer max ){
56 return min + (integer )( llFrand( max - min + 1 ) );
57 }
58 integer MENU_CHANNEL;
59 integer TEXT_BOX_CHANNEL;
60 integer LOCK=TRUE;
61 string timer_status="off";
62 integer SLIDE_DELAY=10;
63 integer SILENT=TRUE;
64 integer current_slide=0;
65 integer slide_timer_counter=0;
66 vector RED =<1.00000, 0.00000, 0.00000>;
67 vector ORANGE=<1.00000, 0.43763, 0.02414>;
68 vector YELLOW=<1.00000, 1.00000, 0.00000>;
69 vector GREEN=<0.00000, 1.00000, 0.00000>;
70 vector BLUE=<0.00000, 0.00000, 1.00000>;
71 vector BABYBLUE=<0.00000, 1.00000, 1.00000>;
72 vector PINK=<1.00000, 0.00000, 1.00000>;
73 vector PURPLE=<0.57338, 0.25486, 1.00000>;
74 vector BLACK= <0.00000, 0.00000, 0.00000>;
75 vector WHITE= <1.00000, 1.00000, 1.00000>;
76 integer UNLOCKED=FALSE;
77 integer LOCKED=TRUE;
78 update_inventory(){
79 integer index=0;
81 while(index < total_items){
83
84 textures+=item_name;
85 llInstantMessage(llGetOwner(), "Adding "+item_name+" to the presentation.");
86 ++index;
87 }
88 if(total_items!=0){
89 llSetTexture(llList2String(textures, current_slide), ALL_SIDES);
90 }
91 }
92 menu(key user_key){
93 string lock_message;
94 if(user_key==llGetOwner()){
95 list timer_option;
96 list menu_options;
97 list lock_option;
98 list silent_option;
99 if(timer_status=="on"){
100 timer_option=["Stop Timer"];
101 }else{
102 timer_option=["Start Timer"];
103 }
104 if(LOCK==TRUE){
105 lock_option=["unlock"];
106 lock_message="Slide show is currently locked";
107
108 }else{
109 lock_option=["lock"];
110 llSay(0,"currently unlocked");
111 lock_message="Slide show is currently unlocked";
112 }
113 if(SILENT==FALSE){
114 silent_option=["Messages on"];
115 }else{
116 silent_option=["Messages off"];
117 }
118 menu_options = ["Reset","Set Timer"]+ timer_option+ ["Next", "Previous"]+lock_option+silent_option;
119 llDialog(user_key, lock_message+"\nSlide "+(string)(current_slide+1)+" of "+(string)llGetListLength(textures)+".\nPlease select an option", menu_options,MENU_CHANNEL);
120 }
121 else{
122 if(LOCK==FALSE){
123 llDialog(user_key, "Please select an option", ["Next","Previous"],MENU_CHANNEL);
124 }else{
125 llDialog(user_key, "Sorry, only "+(string)llKey2Name(llGetOwner())+" is allowed to control this presenter", ["Ok"],MENU_CHANNEL);
126 }
127 }
128 }
129 next_slide(key user_key){
130 current_slide++;
131 if(current_slide>llGetListLength(textures)-1){
132 current_slide=0;
133 }
134 if(SILENT==FALSE){
135 //say to all users
136 llSay(0,"Advancing to slide "+(string)(current_slide+1));
137 }else{
138 //say only to user who pressed
139 if(user_key!=NULL_KEY){
140 llInstantMessage(user_key, "Going to slide "+(string)(current_slide+1));
141 }
142 }
143 llSetTexture(llList2String(textures, current_slide), ALL_SIDES);
144 }
145 prev_slide(key user_key){
146 current_slide--;
147 if(current_slide<0){
148 current_slide=llGetListLength(textures)-1;
149 }
150 if(SILENT==FALSE){
151 //say to all users
152 llInstantMessage(user_key, "Going to slide "+(string)(current_slide+1));
153 }else
154 //say only to user who pressed
155 if(user_key!=NULL_KEY){
156 llInstantMessage(user_key, "Going to slide "+(string)(current_slide+1));
157 }
158
159 llSetTexture(llList2String(textures, current_slide), ALL_SIDES);
160 }
161 default {
162 state_entry() {
163 llSetText("", RED, 1);
164 LOCK=TRUE;
165 MENU_CHANNEL=random_integer(-900000-30,000);
166 TEXT_BOX_CHANNEL=random_integer(-1900000,-900000);
167 llListen(MENU_CHANNEL, "", "", "");
168 llListen(TEXT_BOX_CHANNEL, "", "", "");
169 update_inventory();
170
171
172 }
173 touch_start(integer num_detected) {
174 integer n;
175
176 for (n=0;n<num_detected;n++){
177 menu(llDetectedKey(n));
178
179 }
180 }
181 listen(integer channel, string name, key user_key, string command) {
182
183 if(channel==MENU_CHANNEL){
184 if(command=="Reset"){
185 llShout(0,"Reseting Presenter");
187 }else
188 if(command=="lock"){
189 if(user_key!=llGetOwner()){
190 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to lock the presenter.");
191 return;
192 }//only allow owner to control if presenter is locked
193 LOCK = TRUE;
194 llInstantMessage(user_key, "Presenter locked.");
195 }else
196 if(command=="unlock"){
197 if(user_key!=llGetOwner()){
198 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to lock the presenter.");
199 return;
200 }//only allow owner to control if presenter is locked
201 LOCK = FALSE;
202 llInstantMessage(user_key, "Presenter unlocked.");
203 }else
204 if(command=="Messages off"){
205 if(user_key!=llGetOwner()){
206 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to turn messages off.");
207 return;
208 }//only allow owner to control if presenter is locked
209 SILENT = TRUE;
210 llInstantMessage(user_key, "Messages off.");
211 }else
212 if(command=="lock"){
213 if(user_key!=llGetOwner()){
214 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to turn messages on.");
215 return;
216 }//only allow owner to control if presenter is locked
217 SILENT = FALSE;
218 llInstantMessage(user_key, "Messages on.");
219 }else
220 if(command=="Set Timer"){
221 if(user_key!=llGetOwner()){return;}//only allow owner to control
222 //http://wiki.secondlife.com/wiki/LlTextBox
223 llTextBox( user_key, "Please enter the time in seconds", TEXT_BOX_CHANNEL);
224 }else
225 if(command=="Start Timer"){
226 if(user_key!=llGetOwner()&&LOCK==TRUE){return;}//only allow owner to control if presenter is locked
228 timer_status="on";
229 llInstantMessage(user_key, "Time started");
230 }else
231 if(command=="Stop Timer"){
232 if(user_key!=llGetOwner()&&LOCK==TRUE){return;}//only allow owner to control if presenter is locked
234 timer_status="off";
235 llSetText("", RED, 1);
236 llInstantMessage(user_key, "Timer stopped");
237 }else
238 if(command=="Previous"){
239
240 if(user_key!=llGetOwner()&&LOCK==TRUE){//only allow owner to control if presenter is locked
241 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to change the slides.");
242 return;
243 }
244 prev_slide(user_key);
245 }else
246 if(command=="Next"){
247 if(user_key!=llGetOwner()&&LOCK==TRUE){
248 llSay(0,"Sorry, only "+llKey2Name(llGetOwner())+" is allowed to change the slides.");
249 return;
250 }
251 next_slide(user_key);
252
253 }
254 }else if(channel==TEXT_BOX_CHANNEL){
255 if(user_key!=llGetOwner()){
256 llInstantMessage(user_key,"Sorry, only "+llKey2Name(llGetOwner())+" change the timer.");
257 return;
258 }
259 SLIDE_DELAY=(integer)command;
260 if(SLIDE_DELAY==0){
262 timer_status="off";
263 llInstantMessage(user_key,"Slideshow stopped");
264 llSetText("", RED, 1);
265 }else{
266 llInstantMessage(user_key,"Slide delay set to "+(string)SLIDE_DELAY);
267 timer_status="on";
269 }
270 }
271 menu(user_key);
272 }
273 timer() {
274
275 slide_timer_counter++;
276 if((SLIDE_DELAY-slide_timer_counter)<0){
277 slide_timer_counter=0;
278 next_slide(NULL_KEY);
279 }
280 llSetText("Time before next slide: "+(string)(SLIDE_DELAY-slide_timer_counter), RED, 1);
281
282 }
283 changed(integer change)
284 {
285 // Was it an inventory change?
287 update_inventory();
288 }
289 }
290 }

Back to the Best Free Tools in Second Life and OpenSim.