[help] AddTimer to change var - 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] AddTimer to change var (/showthread.php?tid=61887)
[help] AddTimer to change var by laurenz on 06-28-2006 at 12:27 PM
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?
RE: [help] AddTimer to change var by Eljay on 06-28-2006 at 12:37 PM
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
RE: [help] AddTimer to change var by alexp2_ad on 06-28-2006 at 12:38 PM
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...
RE: RE: [help] AddTimer to change var by laurenz on 06-28-2006 at 02:04 PM
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)
RE: [help] AddTimer to change var by Eljay on 06-28-2006 at 02:11 PM
try using mine.
RE: [help] AddTimer to change var by laurenz on 06-28-2006 at 05:01 PM
i did, it worked, thank you
btw, can you explain why the + Origin is added? maybe i can learn from it.
RE: [help] AddTimer to change var by Mr. Bougo on 06-28-2006 at 06:20 PM
It has "reset" + Origin to know it's a reset timer and one reset timer for each contact
|