Shoutbox

Need help making a new script - 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: Need help making a new script (/showthread.php?tid=73626)

Need help making a new script by Emperor on 04-15-2007 at 04:51 PM

Hi, I am making a script for an online game I play, Torn City. It is a script that will search player ID's. One person helped me a little bit, but I still can't get it to work. This is my first script, so I'm not surprised. Please add me to msn to talk about it more privately and I will show you the code :)

EDIT: It sort of working now, i jus cant figure out how to get it into the / command menu :(

[Image: zippycussing.gif]


RE: Need help making a new script by win_crook on 04-16-2007 at 02:55 PM

You need to add two functions to your script.

code:
function OnGetScriptCommands()
{
    var s = "<ScriptCommands>";
    s += "<Command>";
    s += "<Name>!!COMMAND NAME HERE!!</Name>";
    s += "<Description>!!COMMAND DESC. HERE!!</Description>";
    s += "</Command>";
    s += "</ScriptCommands>";
    return s;
}


code:
function OnEvent_ChatWndSendMessage(ChatWnd, strMessage)
{
    if (strMessage.charAt(0) != '/') return strMessage;
    var arrMessage = strMessage.split(' ');
    var strCommand = arrMessage[0];
    switch(strCommand){
        case "/!!COMMAND NAME HERE!!":
            !!DO COMMAND STUFF HERE!!
            return "";
        default:
            return strMessage;
    }
}


The parts which you will need to edit I have highlighted with "!!". :D

Good Luck (Y),
David
RE: Need help making a new script by Emperor on 04-17-2007 at 12:47 AM

I had the first one, but I didn't know about the second one, thanks. ^_^

Btw, my script is to search for a player ID on an online game, it works and everything now, but how do I get it to put the ID at the end of a link?

Example:  www.game.com/profileview.php?ID=*ID number goes here*

Thanks :)


RE: Need help making a new script by Lou on 04-17-2007 at 12:51 AM

You'll want to create a variable like so:

code:
var idnumber = "2";
(obviously you'll want to set that variable only when you select the id number. Now when you do that, you'll want to take the part where you open the url, and add idnumber to it, like this:
code:
"www.game.com/profileview.php?ID=" + idnumber;

RE: Need help making a new script by Emperor on 04-17-2007 at 09:08 PM

Now its always searching for the ID number 2 :(


RE: RE: Need help making a new script by matty on 04-18-2007 at 01:30 AM

quote:
Originally posted by Emperor
Now its always searching for the ID number 2 :(


You will need to code it so it find the ID number based on the profile name or however its done.
RE: Need help making a new script by Emperor on 04-18-2007 at 02:34 AM

quote:
Originally posted by Matty
You will need to code it so it find the ID number based on the profile name or however its done.

Well I want it so that I could type:

/PlayerID *players ID here*

So basically I just want that number to be attached to the end of the link the game is using. (Keep in mind this is the first thing I've written in JS :P)

Btw heres my code:

function OnEvent_Initialize(MessengerStart)
{
}

function OnGetScriptCommands()
{
    var s = "<ScriptCommands>";
    s += " <Command>";
    s += " <Name>PlayerID</Name>";
    s += " <Description>Search Player ID's!</Description>";
    s += " </Command>";
    s += "</ScriptCommands>";
return s;
}

Debug.Trace("Hello World!");

function OnEvent_ChatWndSendMessage(ChatWnd, strMessage)
{
     if (strMessage.charAt(0) != '/') return strMessage;
       var arrMessage = strMessage.split(' ');
       var strCommand = arrMessage[0];
      switch(strCommand){
        case "/PlayerID":
    var idnumber = "2";
    MsgPlus.DisplayToast("Game Search", "You have searched for idnumber", "Please wait.");
    //Interop.Call("shell32", "ShellExecuteW", ChatWnd.Handle, "open", "http://www.game.com/profiles.php?XID=" + idnumber;
    new ActiveXObject("WScript.Shell").Run("http://www.game.com/profiles.php?XID=" + idnumber);
    return "";
    default:
    return strMessage;
}}

Debug.Trace("Hello World!");

function OnEvent_Uninitialize(MessengerExit)
{
}