Shoutbox

What's wrong with my code? - 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: What's wrong with my code? (/showthread.php?tid=89731)

What's wrong with my code? by xVengeance on 03-18-2009 at 03:21 AM

Hi, I'm new to MsgPlus! Scripting and I was wondering what was wrong with my code.

What it's SUPPOSED to do is get the number of active chats and display it in your Display Message.

But seeing as how the Documentation was so wonderful in not showing any examples, I'm going to need some 3rd party help.

code:
function OnEvent_Initialize(MessengerStart)
{
    MsgPlus.AddTimer("WindowCount", 5000);
    var Windows = Messenger.CurrentChats;
    Messenger.MyPersonalMessage ("Chats open: " + Windows);
}

function OnEvent_Uninitialize(MessengerExit)
{
   
}

function OnEvent_Timer(WindowCount)
{
    MsgPlus.AddTimer("WindowsCounts", 5000);
    var Windows = Messenger.CurrentChats;
    Messenger.MyPersonalMessage ("Chats open: " + Messenger.CurrentChats);
}

function OnEvent_Timer(WindowsCounts)
{
    var Windows = Messenger.CurrentChats;
    Messenger.MyPersonalMessage ("Chats open: " + Messenger.CurrentChats);
}

RE: What's wrong with my code? by John Anderton on 03-18-2009 at 04:27 AM

code:
function OnEvent_Initialize(MessengerStart)
{
    MsgPlus.AddTimer("WindowCount", 5000);
    var Windows = Messenger.CurrentChats;
    Messenger.MyPersonalMessage ("Chats open: " + Windows);
}

function OnEvent_Uninitialize(MessengerExit)
{
   
}

function OnEvent_Timer(WindowCount)
{
    MsgPlus.AddTimer("WindowsCount", 5000);
    var Windows = Messenger.CurrentChats;
    Messenger.MyPersonalMessage ("Chats open: " + Messenger.CurrentChats);
}

Unless you want the script to set your PSM only three times (on initialize, at 5000 and 10000 seconds), you should consider updating your script ;)
(for now, I'm assuming Messenger.CurrentChats shows the chat window count. I can't check since I don't have messenger and the Plus! documentation here :P)
RE: What's wrong with my code? by xVengeance on 03-18-2009 at 05:40 AM

I just want to set a timer to make it update every 5-10 seconds.


RE: What's wrong with my code? by matty on 03-18-2009 at 05:42 AM

Javascript code:
function OnEvent_Initialze(bMessengerStart) {
    if (Messenger.MyStatus < 2) return false;
    Messenger.MyPersonalMessage = 'Chats open: '+Messenger.CurrentChats.Count);
}
 
function OnEvent_ChatWndCreated(pChatWnd) {
    Messenger.MyPersonalMessage = 'Chats open: '+Messenger.CurrentChats.Count);
}
 
function OnEvent_ChatWndDestroyed(pChatWnd) {
    Messenger.MyPersonalMessage = 'Chats open: '+Messenger.CurrentChats.Count-1);
}


That would do it...
RE: What's wrong with my code? by MeEtc on 03-18-2009 at 06:47 AM

I think I made a script in the past that does exactly this.
yep, i did.
http://www.msgpluslive.com/scripts/view/388-ChatCount/