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?

Pages: (2): « First « 1 [ 2 ] Last »
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?
Well based on your code you don't have an updateDisplay function you have an updateMessage function. It would help if you posted the contents of the script debugger window when you try to use your script.
02-13-2009 07:08 AM
Profile E-Mail PM Find Quote Report
Dr Nick
Junior Member
**

Avatar
Firefox > IE

Posts: 59
Reputation: 1
31 / Male / Flag
Joined: Dec 2008
O.P. RE: How to make a menu and commands?
Thanks. I replaced the display with message, but still I have the same problem...

code:
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
Function called: OnGetScriptMenu
Function called: OnEvent_MenuClicked
Function called: OnGetScriptCommands
Function called: OnEvent_ChatWndSendMessage


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

Thanks again
<?
while(!success) { $try++; }
?>
-----------------
Windows 7 Ultimate (6.1.7000)
Windows Live Messenger 14.0.0206
Messenger Plus! Live 4.81.0.358
02-13-2009 08:08 AM
Profile PM Web Find Quote Report
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.

Javascript 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
Dr Nick
Junior Member
**

Avatar
Firefox > IE

Posts: 59
Reputation: 1
31 / Male / Flag
Joined: Dec 2008
O.P. RE: How to make a menu and commands?
OK, thanks a heap, Matty.

The menu works perfectly now, but the command only kinda works.

When i enter the command, my PM rotates manually through the PM's in the script, as it should, but then an error message pops up, same as before saying that it wasn't recognised as a command, and if it wasnt mean to be, enter another / at the beginning...

Any ideas on this?

Thanks so much for your help so far,
Nick.
<?
while(!success) { $try++; }
?>
-----------------
Windows 7 Ultimate (6.1.7000)
Windows Live Messenger 14.0.0206
Messenger Plus! Live 4.81.0.358
02-13-2009 11:41 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: How to make a menu and commands?
Wow I really am feeling embarrassed right now... I shouldn't be making these mistakes...

Javascript code:
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();
                    return '';                    break;
        }
    }
}


The reason you need to return false is because if you do not Messenger Plus! tries to parse the command and since it isn't recognized it fails.
02-14-2009 04:23 AM
Profile E-Mail PM Find Quote Report
Dr Nick
Junior Member
**

Avatar
Firefox > IE

Posts: 59
Reputation: 1
31 / Male / Flag
Joined: Dec 2008
O.P. RE: How to make a menu and commands?
Wow, works perfectly!

Thanks a bunch, Matty! :D

I still have a lot of work to do, but hopefully I'll be able to do it myself from here on! :)

Thanks a heap,
Nick
<?
while(!success) { $try++; }
?>
-----------------
Windows 7 Ultimate (6.1.7000)
Windows Live Messenger 14.0.0206
Messenger Plus! Live 4.81.0.358
02-14-2009 08:02 AM
Profile PM Web Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


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