SHOW:
|
|
- or go back to the newest paste.
| 1 | // Written By: Ĵyм Иøνค (Jym Nova) | |
| 2 | /* | |
| 3 | LICENCE: | |
| 4 | This program is free software: you can redistribute it and/or modify | |
| 5 | it under the terms of the GNU General Public License as published by | |
| 6 | the Free Software Foundation, either version 3 of the License, or | |
| 7 | any later version. | |
| 8 | ||
| 9 | This program is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | GNU General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU General Public License | |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 16 | ||
| 17 | DESCRIPTION: | |
| 18 | - | HoverText Countdown Timer. |
| 18 | + | HoverText Countdown Timer in clock format (75:15:19). |
| 19 | */ | |
| 20 | ||
| 21 | integer menu_handler; | |
| 22 | integer menu_channel; | |
| 23 | integer S; | |
| 24 | ||
| 25 | menu(key user,string title){
| |
| 26 | llListenControl(menu_handler, FALSE); | |
| 27 | llListenRemove(menu_handler); | |
| 28 | menu_channel = (integer)(llFrand(99999.0) * -1); | |
| 29 | menu_handler = llListen(menu_channel,"","",""); | |
| 30 | llTextBox(user,title,menu_channel); | |
| 31 | } | |
| 32 | ||
| 33 | default{
| |
| 34 | on_rez(integer reset){
| |
| 35 | llResetScript(); | |
| 36 | } | |
| 37 | state_entry(){
| |
| 38 | llSetText("",<1,1,1>,0);
| |
| 39 | } | |
| 40 | touch_end(integer num_dtct){
| |
| 41 | if(llDetectedKey(0) == llGetOwner()){
| |
| 42 | menu(llDetectedKey(0),"Enter time in seconds"); | |
| 43 | } | |
| 44 | } | |
| 45 | listen(integer channel, string name, key is, string message){
| |
| 46 | llListenControl(menu_handler, FALSE); | |
| 47 | llListenRemove(menu_handler); | |
| 48 | S = (integer)message; | |
| 49 | llSetTimerEvent(1); | |
| 50 | } | |
| 51 | timer(){
| |
| 52 | if(S > 0){
| |
| 53 | S = S - 1; | |
| 54 | string hr = (string)((S%86400)/3600); | |
| 55 | - | if(S < 60){
|
| 55 | + | string min = (string)(((S%86400)%3600)/60); |
| 56 | - | count = (string)(((S%86400)%3600)%60)+ " seconds."; |
| 56 | + | string sec = (string)(((S%86400)%3600)%60); |
| 57 | - | } |
| 57 | + | |
| 58 | - | else if(S < 3600){
|
| 58 | + | if(llStringLength(hr) < 2){hr = "0"+hr;}
|
| 59 | - | count = (string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds."; |
| 59 | + | if(llStringLength(min) < 2){min = "0"+min;}
|
| 60 | - | } |
| 60 | + | if(llStringLength(sec) < 2){sec = "0"+sec;}
|
| 61 | - | else{
|
| 61 | + | count = hr+":"+min+":"+sec; |
| 62 | - | count = (string)((S%86400)/3600)+" hours, \n" |
| 62 | + | |
| 63 | - | +(string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds."; |
| 63 | + | |
| 64 | - | } |
| 64 | + | |
| 65 | llSetTimerEvent(0); | |
| 66 | llSetText("Times Up!!!",<0,1,0>,1);
| |
| 67 | } | |
| 68 | } | |
| 69 | } |