Shoutbox

Name colour changer - why won't it work? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Name colour changer - why won't it work? (/showthread.php?tid=66410)

Name colour changer - why won't it work? by CrAzY_KeBaB on 09-18-2006 at 05:59 PM

I want to make a script that will toggle through the first 50 colours, so it changes your name, why won't this work:

code:
int run=0;
int x=1;
int y=0;
var myname;

function OnEvent_ChatWndSendMessage(ChatWnd,Origin,Message,MessageKind)
{
    if (Message=="n#on")
    {
        run=1;
        return "";
    }
    if (Message=="n#off")
    {
        run=0
        return "";
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
    if (run==1)
    {
        if (x==50)
        {
            x=1;
            y=0;
        }
        myname=Messenger.MyName;
        myname=myname.replace(y,x);
        Messenger.MyName=myname;
        x++;
        y++;
    }
}


Thanks in advance.
RE: Name colour changer - why won't it work? by Matti on 09-18-2006 at 06:49 PM

quote:
Originally posted by CrAzY_KeBaB
code:
int run=0;
int x=1;
int y=0;


JScript only accepts the var prefix for every type of variable declarations. So, this will be:
code:
var run=0;
var x=1;
var y=0;


I didn't took a look at your other code, but that should at least fix that.
Also, try this:
code:
function OnEvent_Initialize(MessengerStart) {
Debug.DebuggingWindowVisible = true;
}
with the script debugger enabled (Plus! preferences > Scripts > Enable script debugging) to see what error you get on what line in your script. ;)
RE: Name colour changer - why won't it work? by CrAzY_KeBaB on 09-18-2006 at 07:12 PM

OK, still doesn't work, and it can't get any errors, because the script doesn't run:

code:
var run=0;
var x=1;
var y=0;
var myname;

function OnEvent_Initialize(MessengerStart)
{
Debug.DebuggingWindowVisible = true;
}

function OnEvent_ChatWndSendMessage(ChatWnd,Origin,Message,MessageKind)
{
    if (Message=="n#on")
    {
        run=1;
        return "";
    }
    if (Message=="n#off")
    {
        run=0;
        return "";
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
    if (run==1)
    {
        if (x==50)
        {
            x=1;
            y=0;
        }
        myname=Messenger.MyName;
        myname=myname.replace(y,x);
        Messenger.MyName=myname;
        x++;
        y++;
    }
}