What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Need help making a new script

Need help making a new script
Author: Message:
Emperor
New Member
*


Posts: 4
35 / Male / –
Joined: Apr 2007
O.P. Huh?  Need help making a new script
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]

This post was edited on 04-15-2007 at 11:21 PM by Emperor.
04-15-2007 04:51 PM
Profile E-Mail PM Find Quote Report
win_crook
Junior Member
**


Posts: 63
Reputation: 2
31 / Male / Flag
Joined: Apr 2007
RE: Need help making a new script
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
04-16-2007 02:55 PM
Profile PM Find Quote Report
Emperor
New Member
*


Posts: 4
35 / Male / –
Joined: Apr 2007
O.P. RE: Need help making a new script
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 :)
04-17-2007 12:47 AM
Profile E-Mail PM Find Quote Report
Lou
Veteran Member
*****

Avatar

Posts: 2475
Reputation: 43
– / Male / Flag
Joined: Aug 2004
RE: Need help making a new script
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;

This post was edited on 04-17-2007 at 12:51 AM by Lou.
[Image: msghelp.net.png]
The future holds bright things in it\\\'s path, but only time will tell what they are and where they come from.
Messenger Stuff Forums
04-17-2007 12:51 AM
Profile PM Web Find Quote Report
Emperor
New Member
*


Posts: 4
35 / Male / –
Joined: Apr 2007
O.P. RE: Need help making a new script
Now its always searching for the ID number 2 :(
04-17-2007 09:08 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: RE: Need help making a new script
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.
04-18-2007 01:30 AM
Profile E-Mail PM Find Quote Report
Emperor
New Member
*


Posts: 4
35 / Male / –
Joined: Apr 2007
O.P. RE: Need help making a new script
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)
{
}

This post was edited on 04-18-2007 at 02:37 AM by Emperor.
04-18-2007 02:34 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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