Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Clock | Kyrah Abattoir | KDC's non linear solar clock by Kyrah Abattoir.lsl | |
KDC's non linear solar clock by Kyrah Abattoir.lsl
KDC's non linear solar clock by Kyrah Abattoir.lsl
Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.
1 // CATEGORY:Clock 2 // DESCRIPTION:KDC's non linear solar clock by Kyrah Abattoir.lsl 3 // ARCHIVED BY:Ferd Frederix 4 5 //******************************************************** 6 //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!!! 7 //******************************************************** 8 9 10 11 12 13 14 15 16 // KDC's non linear solar clock 17 // Copyright (C) 2005 Kyrah Abattoir 18 // 19 //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. 20 // 21 //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. 22 // 23 // 24 // 25 // This program is free software; you can redistribute it and/or modify 26 // it under the terms of the GNU General Public License as published by 27 // the Free Software Foundation; either version 2 of the License, or 28 // (at your option) any later version. 29 // 30 // This program is distributed in the hope that it will be useful, 31 // but WITHOUT ANY WARRANTY; without even the implied warranty of 32 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 // GNU General Public License for more details. 34 35 string tod = "am"; 36 integer hour = 3600; 37 integer minute = 60; 38 default 39 { 40 state_entry() 41 { 43 sun_angle.z = 0;//filtering z out 44 45 sun_angle = llVecNorm(sun_angle);//normalize 46 48 49 if(sun_angle.x <0)//if we use the evening part of the quadrant 50 { 51 angle = 180 - angle; 52 tod = "pm";//switch to pm 53 } 54 55 float time = angle * 240;//convert in seconds 57 time -= hour*hours;//substract seconds used by hours 59 60 if( llStringLength(minutes) == 1 )//add a 0 to values of 1 digit 61 minutes = "0"+minutes; 62 64 llSleep(10.0);//sun is updated every 10 seconds 65 llResetScript(); 66 } 67 } // END //