Shoutbox

Help about script - 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 about script (/showthread.php?tid=61165)

Help about script by nuwanda on 06-25-2006 at 07:55 AM

Hi, I am new to that job..I want to write a script that creates a time limit when user signs in. (Just for practising,itsnt useable :) )
I wrote something like that , but it doesnt work ;



function OnEvent_Signin(Mail)
{
        var time;
        var Message = "Your time has started!";
        MsgPlus.DisplayToast("Notice",Message);
        MsgPlus.AddTimer(time,600)       
}

function    OnEvent_Timer(time)
{
        var Message = "Your time is over..Signing out!";
        MsgPlus.DisplayToast("",Message);
Signout();
}



I know i am just a starter,so there can be silly codes up there :D...

Thanks for your help.


RE: Help about script by segosa on 06-25-2006 at 08:07 AM

http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=13

code:
AddTimer(
    [string] TimerId,
    [number] Elapse
);

TimerId
[string] Unique string identifying the new timer. Every script can create up to 100 timers, each one with their own unique identifier. When a timer event occurs, the Id is passed as parameter. You can specify any string you want for TimerId apart from an empty string. Different scripts can use identical TimerId without worrying of possible conflicts.


In other words: NOT an empty variable.

code:
Elapse
[number] Amount of time that has to elapse, in milliseconds, before the event is fired. This number needs to be in the range of 100 to 86,4000,000 (one day).

You probably meant it to be 600 seconds, right? Not milliseconds? Try 600000.

code:
OnEvent_Timer(
    [string] TimerId
);


TimerId
[string] Identifier of the timer as specified in MsgPlus::AddTimer.


Do a check to make sure TimerId is the id you specified when you created the timer.

Also, it's Messenger.Signout();

Refer to the docs often.

Fixed code (untested)

code:
function OnEvent_Signin(Mail)
{
  var Message = "Your time has started!";
  MsgPlus.DisplayToast("Notice", Message);
  MsgPlus.AddTimer("signin",600000)
}

function OnEvent_Timer(timerid)
{
  if (timerid == "signin")
  {
    var Message = "Your time is over..Signing out!";
    MsgPlus.DisplayToast("",Message);
    Messenger.Signout();
  }
}



RE: Help about script by nuwanda on 06-25-2006 at 08:15 AM

Thanks a lot..it worked ;) i need to practice more..I will be there again with a lot of questions :D Thanks