What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Reqest] Script that says heyy to whoever signs on

[Reqest] Script that says heyy to whoever signs on
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: [Reqest] Script that says heyy to whoever signs on
quote:
Originally posted by ryannathans
how about a code for saying heyy only if the contact has NOT been on in the last 10 mins?
That's a bit more difficult. Basically, you'd have to store the time when they went online in some kind of global object and when they come online again, check the time difference first before sending the message.

Here's some documented example code. Have a look at it first, make sure you understand what I've done and then try it out.
Javascript code:
/* Global variables */
var sHelloMessage = "Hey!"; //Message to send on contact sign-in
var oContactSigninTimes = {};   // Store for the contact signin times
var nMinSigninInterval = 10 * 60 * 1000;    // 10 minutes (expressed in milliseconds)
 
function OnEvent_ContactSignin( sEmail ) {
    // Set up some local variables
    var nTime = new Date().getTime();   //Get the current time, as a number
    var nLastSignin = 0;    //Placeholder for the contact's last sign-in time
    // First check if we have a logged sign-in time
    if( nLastSignin = oContactSigninTimes[sEmail] ) {
        // Compare it to the time now
        if( (nTime - nLastSignin) < nMinSigninInterval ) {
            // If the difference is less than the configured interval,
            // stop further execution of this function.
            return;
        }
    }
    // If we don't have a previously logged sign-in time or
    // if the difference is greater than the configured interval,
    // store the current time and send the message.
    oContactSigninTimes[sEmail] = nTime;
    Messenger.OpenChat(sEmail).SendMessage(sHelloMessage);
}

Oh, and by the way: we have an [Image: edit.gif] button here, no need for double post in less than a minute! :P

This post was edited on 04-30-2009 at 04:13 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-30-2009 04:12 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Reqest] Script that says heyy to whoever signs on - by ryannathans on 04-30-2009 at 08:27 AM
RE: [Reqest] Script that says heyy to whoever signs on - by Baggins on 04-30-2009 at 10:23 AM
RE: [Reqest] Script that says heyy to whoever signs on - by ryannathans on 04-30-2009 at 10:39 AM
RE: [Reqest] Script that says heyy to whoever signs on - by Spunky on 04-30-2009 at 12:00 PM
RE: [Reqest] Script that says heyy to whoever signs on - by ryannathans on 04-30-2009 at 12:27 PM
RE: [Reqest] Script that says heyy to whoever signs on - by Matti on 04-30-2009 at 04:12 PM
RE: [Reqest] Script that says heyy to whoever signs on - by ryannathans on 05-01-2009 at 07:39 AM


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