Real Time Clock (uses JS)

lightwriter
I have code of a real-time clock that requires the use of Javascript...
I'm currently working on a game similar to Animal Crossing and Fantasy Life using real time elements.
I can't upload the .quest file for some reason so you'll have to create the javascript file yourself.
Here is the code:

//minute
function minute(){
var currentdate = new Date();
var minute = currentdate.getMinutes();
if (minute < 10) {
minute = "0" + minute
}
else {
minute = minute
}
ASLEvent("java_minute",minute)
}
//hour
function hour() {
var currentdate = new Date();
var hour = currentdate.getHours();
if (hour < 13) {
hour = hour
}
else {
hour = hour - 12
}
ASLEvent("java_hour",hour)
}
//month
function month() {
var currentdate = new Date();
var month = parseInt((currentdate.getMonth()+1));
ASLEvent("java_month",month)
}
//day
function day() {
var currentdate = new Date();
var day = currentdate.getDate();
ASLEvent("java_day",day)
}
//determines AM or PM
function suffix() {
var currentdate = new Date();
var suffix;
var hour = currentdate.getHours();
if (hour < 11) {
suffix = " AM ";
}
else {
suffix = " PM ";
}
ASLEvent("timesuffix",suffix)
}


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums