What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [help] AddTimer to change var

[help] AddTimer to change var
Author: Message:
laurenz
Junior Member
**


Posts: 23
Joined: Sep 2005
O.P. [help] AddTimer to change var
i got this nifty code:
code:
var gepraat = Array();

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{

    if(MessageKind == 1 && Messenger.MyStatus == 7 && Messenger.MyName != Origin && gepraat[Origin] != true)
    {

        var Message = "Hoi " + Origin +". \n Hier komt zo te staan wat je kan doen:\n 1. Niks\n 2. Ook niks\n 3. Nog steeds niks."
            ChatWnd.SendMessage(Message);
        gepraat[Origin] = true
       
    }
}

but now i want after 10 secs, that the gepraat[Origin] value gets resetted to false again. does anybody know how to implent the AddTimer function?
06-28-2006 12:27 PM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [help] AddTimer to change var
after "gepraat[Origin] = true"
add this:
code:
MsgPlus.AddTimer('reset' + Origin, 10000);

then add this function:
code:
function OnEvent_Timer(TimerId)
{
   if(TimerId.substr(0,5) == 'reset'){
      gepraat[TimerId.substr(5)] = false;
   }
}

Note: not tested :P
06-28-2006 12:37 PM
Profile PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
37 / Male / –
Joined: May 2004
Status: Away
RE: [help] AddTimer to change var
code:
var gepraat = Array();

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{

if(MessageKind == 1 && Messenger.MyStatus == 7 && Messenger.MyName != Origin && gepraat[Origin] != true)
{

var Message = "Hoi " + Origin +". \n Hier komt zo te staan wat je kan doen:\n 1. Niks\n 2. Ook niks\n 3. Nog steeds niks."
ChatWnd.SendMessage(Message);
gepraat[Origin] = true;
MsgPlus.AddTimer('reset',10000);
}
}

function OnEvent_Timer(sTimerId){
if(sTimerId == 'reset'){ gepraat[Origin] = false; }
}


Should do the trick...
06-28-2006 12:38 PM
Profile E-Mail PM Find Quote Report
laurenz
Junior Member
**


Posts: 23
Joined: Sep 2005
O.P. RE: RE: [help] AddTimer to change var
quote:
Originally posted by alexp2_ad
code:
var gepraat = Array();

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{

if(MessageKind == 1 && Messenger.MyStatus == 7 && Messenger.MyName != Origin && gepraat[Origin] != true)
{

var Message = "Hoi " + Origin +". \n Hier komt zo te staan wat je kan doen:\n 1. Niks\n 2. Ook niks\n 3. Nog steeds niks."
ChatWnd.SendMessage(Message);
gepraat[Origin] = true;
MsgPlus.AddTimer('reset',10000);
}
}

function OnEvent_Timer(sTimerId){
if(sTimerId == 'reset'){ gepraat[Origin] = false; }
}


Should do the trick...

i get this error:
> Fout detected at line 21: 'Origin' is not defined.
  (Code: -2146823279)
06-28-2006 02:04 PM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [help] AddTimer to change var
try using mine.
06-28-2006 02:11 PM
Profile PM Find Quote Report
laurenz
Junior Member
**


Posts: 23
Joined: Sep 2005
O.P. RE: [help] AddTimer to change var
i did, it worked, thank you :)
btw, can you explain why the + Origin is added? maybe i can learn from it.
06-28-2006 05:01 PM
Profile E-Mail PM Find Quote Report
Mr. Bougo
Junior Member
**


Posts: 51
34 / Male / –
Joined: Jun 2006
RE: [help] AddTimer to change var
It has "reset" + Origin to know it's a reset timer and one reset timer for each contact ;)
06-28-2006 06:20 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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