Countdown script using hella script time

Creating scripts
Post Reply
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Countdown script using hella script time

Post by Mike Lorrey »

This script seems to vary between 12 to 27 ms of script time. Is this reasonable or can I make it more efficient, and if so, suggestions? It seems a bit laggy for a timer/settext script

string ConvertWallclockToTime()
{
integer now = (integer)llGetWallclock();
integer seconds = 60 - (now % 60);
integer minutes = 60 - ( (now / 60) % 60);
integer hours = 24 - (now / 3600);
return "You Now Have:\n" + llGetSubString("0" + (string)hours, -2, -1) + ":"
+ llGetSubString("0" + (string)minutes, -2, -1) + ":"
+ llGetSubString("0" + (string)seconds, -2, -1) + "\nTill The End Of\nThe Universe\nThank You!!!";
}

default
{
state_entry ()
{
llSetTimerEvent(1.0);
}


timer()
{
llSetText(ConvertWallclockToTime(),<0,0,0>,1.0);

}
}
Post Reply