Shoutbox

Command parser not working - 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: Command parser not working (/showthread.php?tid=84867)

Command parser not working by SmokingCookie on 07-16-2008 at 09:42 PM

Hi,

I am experiencing a problem with a new way of parsing commands.

The following code displays an error about invalid commands:

code:
function OnEvent_ChatWndSendMessage(pChatWnd,sMessage) {
    if(Initialised) {
        isCommand = parseCommands(pChatWnd,sMessage.toLowerCase());
        if(isCommand) {
            return "";
        }
        return sMessage;
    }
}

function parseCommands(objChatWnd,strMessage) {
    if(strMessage.substr(1,12) == "skincreator" && strMessage.charAt(0) == "/") {
        Splitter = sterMessage.split(" ");
        FunctionName = Splitter[1];
        if(FunctionName == "openskin") {
            Skin.Name = strMessage.substr(21);
            BrowseFile(Skin.Dir + "\\" + Skin.Name,"xml");
        }
        return true;
    } else {
        return false;
    }
}


To make things worse, nothing shows up in the debugger.

Does anyone know what's wrong with this code?

Tnx in advance.
RE: Command parser not working by matty on 07-16-2008 at 11:32 PM

code:
function OnEvent_ChatWndSendMessage(pChatWnd,sMessage) {
    if(Initialised) {
        isCommand = parseCommands(pChatWnd, sMessage.toLowerCase());
        if(isCommand) {
            return "";
        }
        return sMessage;
    }
}

function parseCommands(objChatWnd,strMessage) {
    if(strMessage.substr(1,12) == "skincreator" && strMessage.charAt(0) == "/") {
        Splitter = sterMessage.split(" ");
        FunctionName = Splitter[1];
        if(FunctionName == "openskin") {
            Skin.Name = strMessage.substr(21);
            BrowseFile(Skin.Dir + "\\" + Skin.Name,"xml");
        }
        return true;
    } else {
        return false;
    }
}

RE: Command parser not working by SmokingCookie on 07-17-2008 at 07:30 AM

Err.. I don't see much difference between your code and mine.. And besides, it doesn't work either.. *-)


RE: Command parser not working by Volv on 07-17-2008 at 07:54 AM

I think he highlighted your problem. There is no sterMessage variable.


RE: Command parser not working by SmokingCookie on 07-17-2008 at 08:00 AM

:wall:

Sorry!! :$

I didn't see that typo, and I can barely see bold text on my monitor :S