Hi, 
What I'm trying to do, is this:
[you type] /countdown
[send msg]5
[send msg]4
[send msg]3
[send msg]2
[send msg]1
[send msg]"Happy Newyear"
This is what I have so far:
code:
var counter = 6;
var currentCW;
var counting = false;
function OnEvent_Initialize(MessengerStart)
{
    Debug.trace(" ");
    Debug.trace("------------------ My Script initialised ------------------");
    Debug.trace(" ");
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function OnEvent_ChatWndSendMessage(chatWnd, msg)
{
    if(counting)
    {
        return "";
    }
    var isCommand = checkCommand(msg);
    if(isCommand)
    {
        var command = getCommand(msg);
        switch (command)
        {            
            case "countdown":
                counting = true;
                countDown(chatWnd);
                return "";
                break;
                
            default:
                break;
        }
    }
    else
    {
        return msg;
    }
}
function countDown(chatWnd)
{
    currentCW = chatWnd;
    MsgPlus.AddTimer("commandCountDown", 500);
}
function onEvent_Timer()
{
    counter --;
    Debug.trace("counter = "+counter);
    if(counter == 0)
    {
        counting = false;
        sendMessage("Happy New Year!");
    }
    else
    {
        Debug.trace("Else");
        sendMessage(counter);
    }
}
function sendMessage(msg)
{
    currentCW.sendMessage(msg)
}
function getCommand(msg)
{
    var msgArray = msg.split(" ");
    var command = msgArray[0].substr(1);
    return command;
}
function checkCommand(msg)
{
    if(msg.charAt(0) == "/")
    {
        if(msg.charAt(1) == "/")
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    else
    {
        return false;
    }
}
(I know this code could be A LOT shorter, but i'm trying to do it as well-structured as possible).
I think the problem is that every time a message is sent, the OnEvent_ChatWndSendMessage is called (so not just, when I type something, but also when msn sends out a message (window.sendMessage()

.
I thought this would be fixed by the 'counting' var but appearantly, it is not.
I also created an extra variable 'currentCW' because I didn't know how to keep track of the current window, while going from AddTimer to onEvent_Timer
And lastly: Does type-casting exist in JScript? 
'cause now, i have this:
sendMessage(counter);
but sendMessage requires a string, not a number. Is it automaticly being casted? (And is there a way to do it manually ?)
All help is welcome 

.