Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Countdown seconds by delta_time's microseconds
- totalSeconds -= (delta_time/1000000);
- var t,years,days,hours,minutes,seconds,timerDisplay;
- //Integer Math
- t = (60*60*24*365); years = (totalSeconds div t); //Does not handle leap years
- t = (60*60*24); days = (totalSeconds div t) % 365;
- t = (60*60); hours = (totalSeconds div t) % 24;
- t = (60); minutes = (totalSeconds div t) % 60;
- t = (1); seconds = (totalSeconds div t) % 60;
- //Convert Integers to String Values
- years = string(years);
- days = string(days);
- if (hours < 10) hours = "0"+string(hours); //If timer value is less than 10
- else hours = string(hours); // add "0" for two-digit counter
- if (minutes < 10) minutes = "0"+string(minutes);
- else minutes = string(minutes);
- if (seconds < 10) seconds = "0"+string(seconds);
- else seconds = string(seconds);
- timerDisplay = years + "years / " +
- days + "days\n" +
- hours + ":" + minutes + ":" + seconds;
- draw_text(x,y,"Remaining Time:\n" + timerDisplay);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement