// Written By: Ĵyм Иøνค (Jym Nova)
/*
LICENCE:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
DESCRIPTION:
HoverText Countdown Timer.
*/
integer menu_handler;
integer menu_channel;
integer S;
menu(key user,string title){
llListenControl(menu_handler, FALSE);
llListenRemove(menu_handler);
menu_channel = (integer)(llFrand(99999.0) * -1);
menu_handler = llListen(menu_channel,"","","");
llTextBox(user,title,menu_channel);
}
default{
on_rez(integer reset){
llResetScript();
}
state_entry(){
llSetText("",<1,1,1>,0);
}
touch_end(integer num_dtct){
if(llDetectedKey(0) == llGetOwner()){
menu(llDetectedKey(0),"Enter time in seconds");
}
}
listen(integer channel, string name, key is, string message){
llListenControl(menu_handler, FALSE);
llListenRemove(menu_handler);
S = (integer)message;
llSetTimerEvent(1);
}
timer(){
if(S > 0){
S = S - 1;
string count;
if(S < 60){
count = (string)(((S%86400)%3600)%60)+ " seconds.";
}
else if(S < 3600){
count = (string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds.";
}
else{
count = (string)((S%86400)/3600)+" hours, \n"
+(string)(((S%86400)%3600)/60)+" minutes, "+(string)(((S%86400)%3600)%60)+ " seconds.";
}
llSetText("Time remaining: \n"+count,<1,1,1>,1);
}
else{
llSetTimerEvent(0);
llSetText("Times Up!!!",<0,1,0>,1);
}
}
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎