quote:
Originally posted by Zageron
What is a function that I can use to update it every seconds?
You should add a timer which does the check every X milliseconds. The following is a template about how you should do this the right way.
code:
var nTimerOffset = 60 * 1000; //Set the timer offset to one minute (1 min = 60 s = 60000 ms)
//The OnEvent_Initialize event calls OnEvent_SigninReady if you're already signed in on script start.
function OnEvent_Initialize(bMessengerStart) {
if(Messenger.MyStatus > 0) OnEvent_SigninReady(Messenger.MyEmail);
}
//The OnEvent_SigninReady event calls your update function and then creates a timer when you sign in to Messenger.
function OnEvent_SigninReady(sEmail) {
UpdateIt(); //UpdateIt is your update function
MsgPlus.CreateTimer("TimerUpdate", nTimerOffset); //Creates a timer
}
//The OnEvent_Signout event cancels the timer.
function OnEvent_Signout(sEmail) {
MsgPlus.CancelTimer("TimerUpdate");
}
//The OnEvent_Timer event calls your update function and re-creates the timer so it'll create a timed loop.
function OnEvent_Timer(sTimerId) {
if(sTimerId == "TimerUpdate") {
UpdateIt(); //Your update function
MsgPlus.AddTimer(sTimerId, nTimerOffset); //Re-creates the timer
}
}
function UpdateIt() {
//Code goes here...
}