Shoutbox

[HELP] wrong timer triggers - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [HELP] wrong timer triggers (/showthread.php?tid=75929)

[HELP] wrong timer triggers by LifelesS on 07-07-2007 at 05:46 PM

Getting nuts with this...:blah:

I have 2 timers, like this:

code:
function OnEvent_ContactSignin(Email)
{
    MsgPlus.AddTimer("ResetAll", 60000);
    if(...){}

    else
    {
        if(...)
        {
            if(...)
            {
                MsgPlus.AddTimer("UnBlocker", 5000);
            }
            else{}
        }   
    }
}

Then outside the ContactSignIn function I have the OnEvent_Timer, like this:

code:
function OnEvent_Timer(UnBlocker)
{
    .....
}

function OnEvent_Timer(ResetAll)
{
    ....
}


and besides the if's and else's, the timer UnBlocker triggers before timer ResetAll, or at least, it should, but it isn't. Everything works except when I had the function for the ResetAll timer... Does it have anything to do with the scope or the order they're declared? :S


P.S. I didn't put all the code, but if it's needed, just say so.

TIA
RE: [HELP] wrong timer triggers by Volv on 07-07-2007 at 06:21 PM

You're misuing functions (in specific the OnEvent_Timer one). There is only meant to be one instance of OnEvent_Timer in your code which accepts the id of the timer as its parameter:

code:
function OnEvent_Timer(strId)
{
    switch(strId)
    {
        case "UnBlocker":
        .....
        return;


        case "ResetAll":
        .....
        return;
    }
}

RE: [HELP] wrong timer triggers by LifelesS on 07-07-2007 at 06:23 PM

Many thanks for that... I guess the biggest problem is the fact I'm kind of rusty XD :)