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
CLock clock  

clock

Clock.lsl

Category: CLock
By : Beverly Larkin
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for clock
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. clock_1.lsl
1
2
3 //Simple clock by Beverly Larkin to show example of how to use llGetWallClock()
4
5 integer H; //Hours
6 integer M; //Minutes
7 string AP; //AM or PM
8
9 default
10 {
12 {
13 integer T = (integer)llGetWallclock(); // Get time PST
14 if(T > 43200) //If it's after noon
15 {
16 T = T - 43200; //Subtract 12 hours
17 AP = "PM"; //set to PM
18 H = T / 3600; //get hours
19 M = (T - (H * 3600)) / 60; //get minutes
20
21 if(H == 0) //if the hour is 0
22 {
23 H = 12; // make the hour 12
24 }
25 }
26
27 else
28 {
29 AP = "AM"; //set to AM
30 H = T / 3600; //get the hour
31 M = (T - (H * 3600)) / 60; //get minutes
32 if(H == 0) //if the hour is 0
33 {
34 H = 12; // make the hour 12
35 }
36 }
37
38 if(M < 10)
39 {
40 llOwnerSay((string)H + ":" + "0" + (string)M + AP); //if the mintues is less than 10 add the extra 0 (so it doesn't say 1:3PM) for example
41 }
42
43 else
44 {
45 llOwnerSay((string)H + ":" + (string)M + AP); // otherwise just say the time
46 }
47 }
48 } // end

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