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. | |
| 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 count; | |
| 55 | if(S < 60){
| |
| 56 | count = (string)(((S%86400)%3600)%60)+ " seconds."; | |
| 57 | } | |
| 58 | else if(S < 3600){
| |
| 59 | count = (string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds."; | |
| 60 | } | |
| 61 | - | else if(S < 86400){
|
| 61 | + | |
| 62 | count = (string)((S%86400)/3600)+" hours, \n" | |
| 63 | +(string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds."; | |
| 64 | } | |
| 65 | llSetText("Time remaining: \n"+count,<1,1,1>,1);
| |
| 66 | - | count = (string)(S/86400)+" days, "+(string)((S%86400)/3600)+" hours, \n" |
| 66 | + | |
| 67 | else{
| |
| 68 | llSetTimerEvent(0); | |
| 69 | llSetText("Times Up!!!",<0,1,0>,1);
| |
| 70 | } | |
| 71 | } | |
| 72 | } |