Hello,
I need to run a task at the start of each week/month, where I set a value to some Smartfox variables of all users
inside a Smartfox zone. How can I obtain this?
I've tried the Smartfox scheduler but it doesn't works, and I can't find documentation:
scheduler = new _scheduler.Scheduler();
scheduler.startService();
var task1 = new _scheduler.Task( {name:"reset_week", start:"10:00"} );
var handlerObj = {};
handlerObj.doTask = function(task)
{
trace("Executing task: " + task.id.name);
if (task.id.name == "reset_week")
{
trace("[task reset_week] Start at: " + task.id.start)
//task.active = false;
}
}
var taskHandler = new _scheduler.ITaskHandler(handlerObj);
scheduler.addScheduledTask(task1, 3, false, taskHandler);
What does start/stop means in the new _Scheduler.Task?
And what does the delay parameter means in the addScheduledTask?
I don't need any stop or delay, I just need to set some Smartfox variable of all users inside a Zone when a new week/month begin.
How can I do this?
Thanks.
Andrea
Running a task when a new week/month begin (like using cron)
Re: Running a task when a new week/month begin (like using c
No meaning. It is just an example of custom parameter passed to the task.What does start/stop means in the new _Scheduler.Task?
It is how many seconds the scheduler have to wait before executing the task.And what does the delay parameter means in the addScheduledTask?
You probably have to calculate the delay so that the task will be fired exactly at the beginning of a new week or month.I just need to set some Smartfox variable of all users inside a Zone when a new week/month begin.
Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team