What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to make a menu and commands?

How to make a menu and commands?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: How to make a menu and commands?
Not at home at the moment therefore I cannot test this to verify it works however with regards to this:
quote:
Originally posted by Dr Nick
As far as I know, I have no function OnEvent_MenuClicked...

I am still getting that annoying message pop up when I try to send the command
You do have a function called OnEvent_MenuClicked and it is being called you just have an error in the OnEvent_ChatWndSendMessage function.

js code:
var originalPSM;
var idleSeconds;
var isIdle;
var isBusy;
var PSMnumber;
var seconds = 60;

function OnEvent_Initialize(MessengerStart){
    idleSeconds = 0;
    isIdle = false;
    isBusy = false;
    MsgPlus.AddTimer('rotate', seconds * 1000);
}

function updateMessage() {
        if(PSMnumber==1) {
            originalPSM = "Growing old is mandatory, growing up is optional";
            PSMnumber=2;
        } else {
            originalPSM = "There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is.";
            PSMnumber=1;
        }
        Messenger.MyPersonalMessage = originalPSM;
}

function OnEvent_MyStatusChange(NewStatus){
    if( NewStatus == 7 || NewStatus == 6 )
    {
        Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
        MsgPlus.AddTimer( "incIdle", 1000 );
        MsgPlus.AddTimer( "updateDisplay", 6000 );
        isIdle = true;
        isBusy = false;
    } else if(NewStatus == 4) {
        Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and mssngr alerts are off! :)";
        isBusy = true;
        isIdle = false;
        idleSeconds = 0;
    }
    else
    {
        isIdle = false;
        isBusy = false;
        idleSeconds = 0;
        updateMessage();
        MsgPlus.AddTimer('rotate', seconds * 1000);
    }
}

function OnEvent_Timer(sTimerId){
    if( isIdle == false && isBusy == false)
    {
        updateMessage();
        MsgPlus.AddTimer('rotate', seconds * 1000);
        return 0;
    }
    else if( sTimerId == "incIdle" )
    {
        if(isIdle==true) {
            idleSeconds ++;
            MsgPlus.AddTimer( "incIdle", 1000 );
        }
    }
    else if( sTimerId == "updateDisplay" )
    {
        if(isIdle==true) {
            var cIdleSeconds = idleSeconds;
            var idleHours = 0;
            var idleMinutes = 0;
           
            while( cIdleSeconds > 59 )
            {
                cIdleSeconds -= 60;
                idleMinutes ++;
            }
           
            while( idleMinutes > 59 )
            {
                idleMinutes -= 60;
                idleHours ++;
            }
   
            Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
            MsgPlus.AddTimer( "updateDisplay", 6000 );
        }
    }
}

function OnGetScriptCommands(){
    var oCommand = new Commands();
    with (oCommand) {
        AddCommand('pmrotate', 'Rotate your Personal Message');    }
    return oCommand.ExportCommands(); 
}

function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {       
        var _command = RegExp.$1.toLowerCase();
        var _param = RegExp.$2;
        switch (_command) {
>>>            case 'pmrotate':<<<
                    updateMessage();
                    break;
        }
    }
}

function OnGetScriptMenu(nLocation){
    var oMenu = new ScriptMenu();
       
>>>    oMenu.AddItem('/pmrotate', 'Roate your Personal Message');<<<
   
    return oMenu.ExportMenu();
}

function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd){
    OnEvent_ChatWndSendMessage(oChatWnd, sMenuId);
}

The highlighted stuff is what I changed.

This post was edited on 02-13-2009 at 01:47 PM by matty.
02-13-2009 01:45 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
How to make a menu and commands? - by Dr Nick on 02-11-2009 at 02:51 AM
RE: How to make a menu and commands? - by matty on 02-11-2009 at 01:46 PM
RE: How to make a menu and commands? - by Spunky on 02-11-2009 at 02:35 PM
RE: How to make a menu and commands? - by matty on 02-11-2009 at 03:18 PM
RE: How to make a menu and commands? - by Dr Nick on 02-12-2009 at 06:30 AM
RE: How to make a menu and commands? - by djdannyp on 02-12-2009 at 10:50 AM
RE: How to make a menu and commands? - by matty on 02-12-2009 at 01:56 PM
RE: How to make a menu and commands? - by Dr Nick on 02-13-2009 at 06:55 AM
RE: How to make a menu and commands? - by Dr Nick on 02-13-2009 at 06:58 AM
RE: How to make a menu and commands? - by Th3rmal on 02-13-2009 at 07:06 AM
RE: How to make a menu and commands? - by matty on 02-13-2009 at 07:08 AM
RE: How to make a menu and commands? - by Dr Nick on 02-13-2009 at 08:08 AM
RE: How to make a menu and commands? - by matty on 02-13-2009 at 01:45 PM
RE: How to make a menu and commands? - by Dr Nick on 02-13-2009 at 11:41 PM
RE: How to make a menu and commands? - by matty on 02-14-2009 at 04:23 AM
RE: How to make a menu and commands? - by Dr Nick on 02-14-2009 at 08:02 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