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 KDCs_non_linear_solar_clock  

KDCs_non_linear_solar_clock

KDC's non linear solar clock by Kyrah Abattoir.lsl

Category: Clock
By : Kyrah Abattoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for KDCs_non_linear_solar_clock
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. KDCs_non_linear_solar_clock_by_Kyra_1.lsl
1
2 //********************************************************
3 //This Script was pulled out for you by YadNi Monde from the SL FORUMS at http://forums.secondlife.com/forumdisplay.php?f=15, it is intended to stay FREE by it s author(s) and all the comments here in ORANGE must NOT be deleted. They include notes on how to use it and no help will be provided either by YadNi Monde or it s Author(s). IF YOU DO NOT AGREE WITH THIS JUST DONT USE!!!
4 //********************************************************
5
6
7
8
9
10
11
12
13 // KDC's non linear solar clock
14 // Copyright (C) 2005 Kyrah Abattoir
15 //
16 //This is a bit of code i made to reflect the SL sun time, can be useful for roleplaying places that need clocks to display the proper time of the day according to the SL day/night cycle.
17 //
18 //NOTE: the speed at which time flow is not linear, in SL we have 3 hours of daytime for 1 hour of night time, but my clock is designed to consider day/night to be of equal length, so during the night the clock time flow FASTER than during the daytime, of course if the sim where you put the clock has time forced to a specific hour, the clock will be frozen too.
19 //
20 //
21 //
22 // This program is free software; you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation; either version 2 of the License, or
25 // (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31
32 string tod = "am";
33 integer hour = 3600;
34 integer minute = 60;
35 default
36 {
38 {
39 vector sun_angle =llGetSunDirection()*llEuler2Rot(<PI/4,0,0>);//flattening the vector
40 sun_angle.z = 0;//filtering z out
41
42 sun_angle = llVecNorm(sun_angle);//normalize
43
44 float angle = llAcos(sun_angle.y/1)*RAD_TO_DEG;//convert the coords of the sun to angle
45
46 if(sun_angle.x <0)//if we use the evening part of the quadrant
47 {
48 angle = 180 - angle;
49 tod = "pm";//switch to pm
50 }
51
52 float time = angle * 240;//convert in seconds
53 integer hours = (integer)(time/hour);//extract hours
54 time -= hour*hours;//substract seconds used by hours
55 string minutes = (string)((integer)(time/minute));//extract minutes
56
57 if( llStringLength(minutes) == 1 )//add a 0 to values of 1 digit
58 minutes = "0"+minutes;
59
60 llSetText((string)hours+":"+minutes+tod,<1,1,1>,1.0);
61 llSleep(10.0);//sun is updated every 10 seconds
63 }
64 } // END //

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