Event.js to detect a certain time before it functions
I've used automsg.js as a reference & how it usually work is a countdown after the server starts. Is there a way to change it such that it happens once every day at a certain time?
Quote:
var setupTask;
function init() {
scheduleNew();
}
function scheduleNew() {
var cal = java.util.Calendar.getInstance();
cal.set(java.util.Calendar.HOUR, 0);
cal.set(java.util.Calendar.MINUTE, 0);
cal.set(java.util.Calendar.SECOND, 0);
var nextTime = cal.getTimeInMillis();
while (nextTime <= java.lang.System.currentTimeMillis())
nextTime += 1000 * 1000;
setupTask = em.scheduleAtTimestamp("start", nextTime);
}
function cancelSchedule() {
setupTask.cancel(true);
}
function start() {
scheduleNew();
var Message = new Array("Test");
em.getChannelServer().yellowWorldMessage("[Event] " + Message[Math.floor(Math.random() * Message.length)]);
}
Re: Event.js to detect a certain time before it functions