Shoutbox

simple problem :P - 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: simple problem :P (/showthread.php?tid=77799)

simple problem :P by Kukaka on 09-26-2007 at 08:24 PM

This is an edited google query script. Im trying to make it search the highscores of the MMORPG RuneScape and it workd fine untill I try to change the command from /google, !google or !search. What would the problem be? :P I think this is probably me beeing a complete n00b and a very simple problem :D

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    if (Message.substr(0,7) == "/stats")
    {
        Message = Message.substr(8);

        return query(Message);
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if (Message.substr(0,7) == "!google" || Message.substr(0,7) == "!search")
    {
        Message = Message.substr(8);
        ChatWnd.SendMessage("RuneScape HighScores Search Results: " + query(Message));
    }

    if (MessageKind == 4)
    {
        ChatWnd.SendMessage("RuneScape HighScores Search Results: " + query(Message));
    }
}

function query(query)
{
    query = escape(query);
    query = "http://hiscore.runescape.com/hiscorepersonal.ws?user1=" + query;

    return query;
}

function OnGetScriptCommands()
{
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands += "<Command>";
    ScriptCommands += "<Name>RuneScape Stats Lookup</Name>";
    ScriptCommands += "<Description>Search RuneScape Personal HighScores</Description>";
    ScriptCommands += "<Parameters>&lt;search&gt;</Parameters>";
    ScriptCommands += "</Command>";
    ScriptCommands += "</ScriptCommands>";

    return ScriptCommands;
}


RE: simple problem :P by phalanxii on 09-27-2007 at 12:43 AM

I would assume the problem is because you haven't changed the string lengths in the command:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    if (Message.substr(0,6) == "/stats")
    {
        Message = Message.substr(7);
       
        return query(Message);
    }
}

RE: RE: simple problem :P by Kukaka on 09-27-2007 at 06:07 AM

quote:
Originally posted by phalanxii
I would assume the problem is because you haven't changed the string lengths in the command:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    if (Message.substr(0,6) == "/stats")
    {
        Message = Message.substr(7);
       
        return query(Message);
    }
}

Yay! it worked :D Thank you ;)