Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| CLock | Beverly Larkin | Clock.lsl | |
Clock.lsl
Clock.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:Clock.lsl 3 // ARCHIVED BY:Ferd Frederix 4 5 6 //Simple clock by Beverly Larkin to show example of how to use llGetWallClock() 7 8 integer H; //Hours 9 integer M; //Minutes 10 string AP; //AM or PM 11 12 default 13 { 14 state_entry() 15 { 17 if (T > 43200) //If it's after noon 18 { 19 T = T - 43200; //Subtract 12 hours 20 AP = "PM"; //set to PM 21 H = T / 3600; //get hours 22 M = (T - (H * 3600)) / 60; //get minutes 23 24 if(H == 0) //if the hour is 0 25 { 26 H = 12; // make the hour 12 27 } 28 } 29 30 else 31 { 32 AP = "AM"; //set to AM 33 H = T / 3600; //get the hour 34 M = (T - (H * 3600)) / 60; //get minutes 35 if(H == 0) //if the hour is 0 36 { 37 H = 12; // make the hour 12 38 } 39 } 40 41 if(M < 10) 42 { 43 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 44 } 45 46 else 47 { 49 } 50 } 51 } // end