What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Scripting Problem

[Help] Scripting Problem
Author: Message:
Shadowajohn
Junior Member
**

Avatar
Addiction, it keeps me sane...

Posts: 19
31 / Male / Flag
Joined: Nov 2008
O.P. [Help] Scripting Problem
Not sure if this should be in help & support or scripting..so i put in h&s.

A while ago i made a Xbox360 script (well edited from an old last.fm script with permission) which more or less allows you to post your Xbox Live gamerscore and status to MSN.
I've recently noticed the status function i added no longer works,

It used to output something like:
code:
360 - Shadowajohn: Playing Magic: The Gathering - Playing Campaign (Single Player). Life:16
Now it outputs:
code:
360 - Shadowajohn: Valid - Valid
I've not changed anything since it worked, yet it doesn't work anymore.
I have very limited knowledge in java or xml..and i've tried nearly everything i think it could be.

Here's the full code

code:
//////////////////
// Globals vars //
//////////////////
var GamerTag = '';
var WScript = new ActiveXObject('WScript.Shell');
var message = '';
var user = new Array();
var PC = new Array();


///////////////////////////
// Menu Clicked function //
///////////////////////////


function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
  switch(MenuItemId)
  {
    case "SendGamerScore":
        SendGamerScore(OriginWnd);
        Debug.Trace('[Sent] Gamerscore sent');
    break;
    case "SendStatus":
        SendStatus(OriginWnd);
        Debug.Trace('[Sent] Status sent');
    break;
    case "XboxOptions":
        if(Messenger.MyEmail != "")
        {
            GetGamerTag(Messenger.MyEmail);
        }
        plusWnd = MsgPlus.CreateWnd('Windows.xml', 'XboxOptions');
        plusWnd.SetControlText('EdtGamerTag', GamerTag);
        Debug.Trace('[Window] XboxOptions opened');
    break;
    case "XboxAbout":
        plusWnd = MsgPlus.CreateWnd('Windows.xml', 'XboxAbout');
    break;
  }
}

//////////////////////////////
// XboxOptions Clicked Function //
//////////////////////////////

function OnXboxOptionsEvent_CtrlClicked(PlusWnd, ControlId)
{    Debug.Trace('[Clicked] '+ControlId);
    switch (ControlId)
    {
        case "BtnSave":
            GamerTag = PlusWnd.GetControlText('EdtGamerTag');
               if(Messenger.MyEmail != "")
            {
                SetGamerTag(Messenger.MyEmail);
            }
            PlusWnd.Close(1);
            Debug.Trace('[Window] XboxOptions closed');
            break;
    }
}

////////////////////////////
// About Clicked Function //
////////////////////////////

function OnXboxAboutEvent_CtrlClicked(Wnd, sControlId){
    if(sControlId == "lnkWebsite"){
        new ActiveXObject("wscript.shell").run("http://shadowgaming.wordpress.com/");
    }
}

////////////////////////////////////////////
// Get the GamerTag from registry //
////////////////////////////////////////////

function GetGamerTag(email)
{    try
    {
        GamerTag = WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\GamerTag');
        Debug.Trace('[Loaded] XboxLive GamerTag: '+GamerTag);
    }
    catch(exception)
    {        WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\GamerTag', '');
        GetGamerTag(email);
    }
}

//////////////////////////////////////////
// Set the GamerTag in registry //
//////////////////////////////////////////

function SetGamerTag(email)
{    WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\GamerTag', GamerTag);
    Debug.Trace('[Saved] Xbox Live GamerTag: '+GamerTag);
}

///////////////////////////////////
// The SendGamerScore function //
///////////////////////////////////

function SendGamerScore(OriginWnd)
{    if(Messenger.MyEmail != "")
    {
        GetGamerTag(Messenger.MyEmail);
        GetFeed('http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag='+ GamerTag, 'SendGamerScoreHandler', OriginWnd);
    }
}

function SendStatus(OriginWnd)
{    if(Messenger.MyEmail != "")
    {
        GetGamerTag(Messenger.MyEmail);
        GetFeed('http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag='+ GamerTag, 'SendStatusHandler', OriginWnd);
    }
}
//////////////////////////////////////
// The handler for SendGamerScore //
//////////////////////////////////////
function SendGamerScoreHandler(response, OriginWnd)
{
    // empty message var
    message = '';
   
    // Get playcount
    PC = response.selectNodes('XboxInfo');
     for(var i=0; i<PC.length; i++){
    message += GamerTag + " has a total of " + PC[i].childNodes(11).text + "GS";
    }

    OriginWnd.SendMessage(message);
}

//////////////////////////////////////
// The handler for SendStatus //
//////////////////////////////////////
function SendStatusHandler(response, OriginWnd)
{
    // empty message var
    message = '';
   
    // Get playcount
    user = response.selectNodes('XboxInfo/PresenceInfo');
     for(var i=0; i<PC.length; i++){
    message += "360 - " + GamerTag + ": " + PC[i].childNodes(2).text + " - " + PC[i].childNodes(3).text;

    }

    OriginWnd.SendMessage(message);
}

////////////////////////////////////////////////////
// Ajax functions by Lucsas van Dijk (lucasvd.nl) //
////////////////////////////////////////////////////
function GetFeed(url, callback_function, OriginWnd)
{
    var feed = create_http_object();

    feed.onreadystatechange = function()
    {
        if(feed.readyState==4)
        {
            if(feed.status == 200)
            {
                eval(callback_function + '(feed.responseXML, OriginWnd)');
            }
            else
            {
                Debug.Trace('[Error] ' + feed.status);
            }
        }
    }

    Debug.Trace('[URL] '+url);

    feed.open('GET', url, false);
    feed.send(null);
}

function create_http_object()
{
    var ActiveXTypes = [
        "MSXML2.XMLHTTP.5.0",
        "MSXML2.XMLHTTP.4.0",
        "MSXML2.XMLHTTP.3.0",
        "MSXML2.XMLHTTP",
        "Microsoft.XMLHTTP",
    ];

    for( var i = 0; i < ActiveXTypes.length; i++ )
    {
        try
        {            Debug.Trace('[ActiveX] ' + ActiveXTypes[i]);
            return new ActiveXObject( ActiveXTypes[i] );
        }
        catch( e )
        { }
    }

    try
    {
        return new XMLHttpRequest();
    }
    catch( e )
    { }

    return false;
}

Xbox360Stuff Script - Twitter - Blog
X360Stuff Script Status: On-Hold.
Will make/edit a new script soon.
[Image: ShadowAjohn.gif]
07-13-2009 08:22 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help] Scripting Problem - by Shadowajohn on 07-13-2009 at 08:22 PM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:01 AM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:10 AM
RE: [Help] Scripting Problem - by Shadowajohn on 07-16-2009 at 06:21 AM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:25 AM
RE: [Help] Scripting Problem - by Spunky on 07-17-2009 at 02:08 PM


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