What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Timeout Objects

Timeout Objects
Author: Message:
trevorpe
New Member
*


Posts: 12
29 / Male / Flag
Joined: Dec 2008
O.P. RE: Timeout Objects
Hi there guys.

Thanks Matti!!

I didn't use your exact class.  I made my own custom object and changed a few things so I could pass multiple parameters.
But your Idea helped me a lot. Thanks again.  Here's what I wrote.  Please tell me if you find something wrong.
code:
//This is in TimerFunction.js
//Do Not Edit
var Timers = new Array();
var TimersIndex = 0;
function myTimer(FunctionName, Elapse, Parameter, Parameter2, Parameter3, Parameter4, Parameter5) {
    this.FunctionName=FunctionName
    this.Elapse=Elapse;
    this.TimerIndex=TimersIndex++;
    this.Refresh=TimerRefresh;
    this.Delete=TimerDelete;
    FunctionText=FunctionName + "(";
    //Set all parameters
    if (typeof Parameter !== "undefined") {
        this.Param1=Parameter;
        FunctionText+="TimerObj.Param1";
    }
    if (typeof Parameter2 !== "undefined") {
        this.Param2=Parameter2;
        FunctionText+=", TimerObj.Param2";
    }
    if (typeof Parameter3 !== "undefined") {
        this.Param3=Parameter3;
        FunctionText+=", TimerObj.Param3";
    }
    if (typeof Parameter4 !== "undefined") {
        this.Param4=Parameter4;
        FunctionText+=", TimerObj.Param4";
    }
    if (typeof Parameter5 !== "undefined") {
        this.Param5=Parameter5;
        FunctionText+=", TimerObj.Param5";
    }
    this.FunctionText = FunctionText + ")";
    //Set Object
    Timers[this.TimerIndex]=this;
    MsgPlus.AddTimer("myTimer"+this.TimerIndex.toString(), this.Elapse);
}

function TimerRefresh() {
    MsgPlus.AddTimer("myTimer"+this.TimerIndex.toString(), this.Elapse);
}

function TimerDelete() {
    MsgPlus.CancelTimer("myTimer"+this.Index);
     delete Timers[this.Index];
}

function OnEvent_Timer(TimerId) {
    if (TimerId.substring(0, 7) === "myTimer") {
        var TimerObj=Timers[TimerId.substring(7)];
        eval(TimerObj.FunctionText);
    }
}
09-20-2009 11:23 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Timeout Objects - by trevorpe on 09-19-2009 at 11:35 PM
RE: Timeout Objects - by roflmao456 on 09-20-2009 at 01:08 AM
RE: Timeout Objects - by Matti on 09-20-2009 at 06:54 AM
RE: Timeout Objects - by trevorpe on 09-20-2009 at 11:23 AM
RE: Timeout Objects - by Matti on 09-20-2009 at 05:47 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On