What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - No error, no action...

HELP - No error, no action...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. HELP - No error, no action...
It flips the status, or at least it did until I did something to it that stops it working.
js code:
var Activity = "Disabled";

var Messenger = 14;
var Mode = "All Values";
var Refresh = 1000;  // will add a method of changing this later

var OldStatus;

MsgPlus.AddTimer("FlipStatus", Refresh);

function OnGetScriptMenu (nLocation)
{
    Menu = '<ScriptMenu>';
   
    if (Activity == "Enabled")
    {
        Menu += '<MenuEntry Id=\"Activity\">Disable Flip Status...</MenuEntry>';
    }
    else
    {
        Menu += '<MenuEntry Id=\"Activity\">Enable Flip Status...</MenuEntry>';
    }
   
    Menu += '<Separator/>';
   
    if (Activity == "Enabled" || Mode == "On/Off Only")
    {
        Menu += '<MenuEntry Id=\"Messenger\" Enabled=\"false\">Messenger: ' + Messenger + '</MenuEntry>';
    }
    else
    {
        Menu += '<MenuEntry Id=\"Messenger\">Messenger: ' + Messenger + '</MenuEntry>';
    }
   
    if (Activity == "Enabled")
    {
        Menu += '<MenuEntry Id=\"Mode\" Enabled=\"false\">Mode: ' + Mode + '</MenuEntry>';
        Menu += '<MenuEntry Id=\"Refresh\" Enabled=\"false\">Refresh: ' + Refresh + 'ms</MenuEntry>';
    }
    else
    {
        Menu += '<MenuEntry Id=\"Mode\">Mode: ' + Mode + '</MenuEntry>';
        Menu += '<MenuEntry Id=\"Refresh\">Refresh: ' + Refresh + 'ms</MenuEntry>';
    }
   
    Menu += '</ScriptMenu>';
         
    return Menu;
}

function OnEvent_MenuClicked (sMenuId, nLocation, iOriginWnd)
{
    if (sMenuId == "Activity")
    {
        if (Activity == "Enabled")
        {
            Activity = "Disabled";
            Messenger.MyStatus = OldStatus;
        }
        else if (Activity == "Disabled")
        {
            OldStatus = Messenger.MyStatus;
            Activity = "Enabled";
        }
    }
    if (sMenuId == "Messenger")
    {
        if (Messenger == 9)
        {
            Messenger = 14;
        }
        else if (Messenger == 14)
        {
            Messenger = 9;
        }
    }
    if (sMenuId == "Mode")
    {
        if (Mode == "All Values")
        {
            Mode = "On/Off Only";
        }
        else if (Mode == "On/Off Only")
        {
            Mode = "All Values";
        }
    }
}

function OnEvent_Timer(TimerId)
{
    if (TimerId == "FlipStatus")
    {
        if (Activity == "Enabled")
        {
            if (Mode == "All Values")
            {
                if (Messenger == 9)
                {
                    switch (Messenger.MyStatus)
                    {
                        case 3:
                            Messenger.MyStatus = 4;
                            break;
                        case 4:
                            Messenger.MyStatus = 5;
                            break;
                        case 5:
                            Messenger.MyStatus = 7;
                            break;
                        case 7:
                            Messenger.MyStatus = 8;
                            break;
                        case 8:
                            Messenger.MyStatus = 9;
                            break;
                        case 9:
                            Messenger.MyStatus = 3;
                            break;
                        default:
                            Messenger.MyStatus = 3;
                            break;
                    }
                }
                else if (Messenger == 14)
                {
                    switch (Messenger.MyStatus)
                    {
                        case 3:
                            Messenger.MyStatus = 4;
                            break;
                        case 4:
                            Messenger.MyStatus = 7;
                            break;
                        case 7:
                            Messenger.MyStatus = 3;
                            break;
                        default:
                            Messenger.MyStatus = 3;
                            break;
                    }
                }
            }
            else if (Mode == "On/Off Only")
            {
                switch (Messenger.MyStatus)
                {
                    case 2:
                        Messenger.MyStatus = 3;
                        break;
                    case 3:
                        Messenger.MyStatus = 2;
                        break;
                    default:
                        Messenger.MyStatus = 3;
                        break;
                }
            }
        }
        MsgPlus.AddTimer("FlipStatus", Refresh);
    }
}

It's probably something really obvious, but I've been looking at it for 20 minutes and I don't see what's up with it.  If it helps, I found out (using the script debugger) that it always reaches the "switch (Messenger.MyStatus)" bit, but it just doesn't match the number with the status, even though it did before.  Can anyone explain what I must have missed?
04-28-2009 07:50 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: HELP - No error, no action...
Not 100% without looking a bit further into it, buttry changing the variable Messenger to Msgr or something similar. I think it might be conflicting with the object Messenger
<Eljay> "Problems encountered: shit blew up" :zippy:
04-29-2009 05:55 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: HELP - No error, no action...
quote:
Originally posted by Spunky
Not 100% without looking a bit further into it, buttry changing the variable Messenger to Msgr or something similar. I think it might be conflicting with the object Messenger
Very correct. To make it even worse, you're trying to use Messenger in the same scope in both meanings (the object and your number variable) - there's absolutely no way the engine will be able to work with that.

Also, I'd recommend you to use a Boolean value for your Activity and Mode variables. It is totally unnecessary to force the JScript engine into comparing two strings when you know it can only have two values. Try to give your Mode variable a better name, or start using number constants for your settings, it'll greatly improve the quality of your code.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
04-29-2009 10:56 AM
Profile E-Mail PM Web Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: HELP - No error, no action...
Hoorah, it works again.  Thanks!  :)
04-29-2009 06:14 PM
Profile E-Mail PM Find Quote Report
« 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