Jump to content

IRC script to run APB


Jeod

Recommended Posts

A long time ago, I had an IRC javascript that could be loaded into my Chatzilla client. I could run APB and pass parameters with this script by typing in a command, like the following:

!apb <server> <name>

This would translate to "C:\Program Files(x86)\W3DHub\A Path Beyond\game.exe" +connect <server> +netplayername <name>

The script would store a preset list of server IPs that I could have names for and store the path to the exe. I could use additional commands like:

!path <gamepath>

!server <ip> <nickname>

A real-time command, in this case, would be:

!apb official Jeod

Where 'official' would be the official server IP and the name would be my username. In the back-end, the result would be:

"C:\Program Files(x86)\W3DHub\A Path Beyond\game.exe" +connect 178.162.193.144:9016 +netplayername Jeod

I don't recall how I made this. Is someone out there knowledgeable enough to recreate this?

Link to comment
Share on other sites

Lots of us here use mIRC or otherwise KiwiIRC. For mIRC scripts, @Chopbam is definitely your man, he's made a really cool tool that the mods use. (Sorry if we forgot to tell you, you should totally know about that).

On another note (and sorry for the slight hijack)... For a long while now, I've been working "in the shadows" on a direct connect tool for use by renegade mod projects that either don't have a launcher, or like in our case, the launcher is misbehaving. I'm debating on whether or not to release what I have right now because it works fine, it just doesn't have all the features I want in yet.

Its pretty simple. You put info in it, save it as a profile and it keeps up with it. After that you can launch the game really quickly. Here's a screeny.

Capture.thumb.PNG.bb9e47afd7064c44f176784ceaa60c7e.PNG

Link to comment
Share on other sites

Thanks for the tip! But, the reason I used the IRC script so much was because it was easy as a mod. Since my scripts ran clientside, I had an auto-auth script as well as the launcher script which would let me keep IRC open and pop into a server at any given moment with ease. Chopam, have any insight for this kind of project?

Link to comment
Share on other sites

It was something like this...
 

/*     W3DHUB IRC PLUGIN SCRIPT
 *    AUTHOR: JEOD
 *    WEB: http://www.w3dhub.com
 *    CONTRIBUTORS:
*/

plugin.id = "w3dscript";
plugin.minor = 0
plugin.major = 1
plugin.version = plugin.major + "." + plugin.minor;
plugin.description = "Allows direct connection to W3D games using IRC commands";

plugin.init =
function initPlugin()
{
    /*     This function is called when the IRC client first loads the plugin.
     *    It is where we will define new commands
    */
    plugin.cmdary =
    [/* command name    function        flags    usage*/
     ["apb",            cmdAPB,            null,    "null"],
     ["addserver",        cmdAddServer,     null,    "null"],
     ["delserver",        cmdDelServer,     null,    "null"],
     ["listserver",        cmdListServer,     null,     "null"],
     ["gamepath",        cmdProgPath,    null    "null"],
     ["autoauth",        cmdAuth,        null,    "null"]
    ];
    
    client.commandManager.defineCommands(plugin.cmdary);
}

function cmdAPB()
{
    /*    This function enables the user to start APB by passing
     *    included parameters to the executable. The parameters passed
     *    are the server ip address and the desired player name.
    */
}

function cmdAddServer()
{
    /*    This function enables the user to add servers to a file.
     *    The user can set nicknames for servers.
    */
}

function cmdDelServer()
{
    /*    This function enables the user to delete servers from a file.
     *    The user can set nicknames for servers.
    */
}

function cmdListServer()
{
    /*    This function enables the user to list all the servers in a file.
     *    The user can set nicknames for servers.
    */
}

function cmdProgPath()
{
    /*    This function enables the user to set the path to their executable.    */
}

function cmdAuth()
{
    /*    This function authenticates the user automatically when they join a server
     *    that they are a moderator in.
    */
}

 

Link to comment
Share on other sites

I am only familiar with mIRC scripting. My tool does everything you describe and much more. It has a custom window that filters out kill spam and combines the public and moderator chat channels, allowing the user to interact with both channels without needing to switch windows/tabs. It also contains data such as all users ingame and current/nextmap info. I originally made the tool in 2008 for MP-Gaming APB moderators, and it has progressed much since then. Again, it requires mIRC to use and that may not be your cup of tea.

Link to comment
Share on other sites

  • 3 months later...

Well, here we are again. I've found my old script and modified it to suit W3DHub, however it doesn't work. On loading the plugin to Chatzilla, the following error occurs:

I suspect an update to Chatzilla has caused this. It's been a few years after all. Still, I'm adding my source code here in case someone wants to modify it or fix it or something.

/* 	W3DHUB IRC PLUGIN SCRIPT
 *	AUTHORS: JEOD, NOD00
 *	WEB: http://www.w3dhub.com
 *	CONTRIBUTORS:
*/

var file1 = Components.classes["@mozilla.org/file/local;1"]
	.createInstance(Components.interfaces.nsILocalFile);
var process1 = Components.classes["@mozilla.org/process/util;1"]
    .createInstance(Components.interfaces.nsIProcess);
var file2 = Components.classes["@mozilla.org/file/local;1"]
	.createInstance(Components.interfaces.nsILocalFile);
var process2 = Components.classes["@mozilla.org/process/util;1"]
    .createInstance(Components.interfaces.nsIProcess);
var file3 = Components.classes["@mozilla.org/file/local;1"]
	.createInstance(Components.interfaces.nsILocalFile);
var process3 = Components.classes["@mozilla.org/process/util;1"]
    .createInstance(Components.interfaces.nsIProcess);
var file4 = Components.classes["@mozilla.org/file/local;1"]
	.createInstance(Components.interfaces.nsILocalFile);
var process4 = Components.classes["@mozilla.org/process/util;1"]
    .createInstance(Components.interfaces.nsIProcess);

//The variables used in this script
var apbgamepath = "C:\\Program Files(x86)\\W3D Hub\\games\\apb-release\\game.exe";
var tsrgamepath = "C:\\Program Files(x86)\\W3D Hub\\games\\tsr-release\\game.exe";
var artestpath = "C:\\Program Files(x86)\\W3D Hub\\games\\ar-testing\\game.exe";
var tsrtestpath = "C:\\Program Files(x86)\\W3D Hub\\games\\tsr-testing\\game.exe";

var connection1 = "178.162.193.144:9016"; //APB Default IP and Port	
var connection2 = "178.162.193.144:9215"; //TSR Default IP and Port	
var connection3 = ""; //AR-Testing Default IP and Port	
var connection4 = ""; //TSR-Testing Default IP and Port	

file1.initWithPath(apbgamepath);
file2.initWithPath(tsrgamepath);
file3.initWithPath(artestpath);
file4.initWithPath(tsrtestpath);
process1.init(file1);
process2.init(file2);
process3.init(file3);
process4.init(file4);
	
plugin.init =
function _init(glob) {
    display("This plugin can join the following servers: APB (/apb), TSR (/tsr), AR-Test (/art), TSR-Test (/tsrt). You must include a player name after the command. (i.e. /apb yourname) You can also type /edit to edit the server information in any of the above servers. If your game path is different than the default install path, you can change it by typing in /[game]path (i.e. /apbpath). You can also restore the default settings by typing /restore.");
		plugin.id = "W3D Hub IRC Launcher";
		plugin.minor = 1;
		plugin.major = 0;
		plugin.version = plugin.major + "." + plugin.minor;
		plugin.description = "Allows direct connection to W3D games using IRC commands";
		plugin.cmdlist = [   
						/* command name	function					flags		usage*/
						["apbpath",		cmdEditAPBPath,				CMD_CONSOLE | CMD_NO_HELP],
						["tsrpath",		cmdEditTSRPath,				CMD_CONSOLE | CMD_NO_HELP],
						["artpath",		cmdEditARTestPath,			CMD_CONSOLE | CMD_NO_HELP],
						["tsrtpath",	cmdEditTSRTestPath,		CMD_CONSOLE | CMD_NO_HELP],
	 
						["edit",		cmdEditConnect,				CMD_CONSOLE | CMD_NO_HELP],
	 
						["apb",			cmdLaunchAPBServer,			CMD_CONSOLE | CMD_NO_HELP, "<name>"],
						["tsr",			cmdLaunchTSRServer,			CMD_CONSOLE | CMD_NO_HELP, "<name>"],
						["art",			cmdLaunchARTestServer,		CMD_CONSOLE | CMD_NO_HELP, "<name>"],
						["tsrt",		cmdLaunchTSRTestServer,	CMD_CONSOLE | CMD_NO_HELP, "<name>"],
		 
						["restore",		cmdRestoreDefaults,			CMD_CONSOLE | CMD_NO_HELP],
						["about",		cmdServerList,				CMD_CONSOLE | CMD_NO_HELP]
						//Add a comma at the end of the previous command if you wish to make another command
						];
        client.commandManager.defineCommands(plugin.cmdlist);
}

plugin.enable =
function _enable() {
	plugin.commands = client.commandManager.defineCommands(plugin.cmdlist);
	return true;
   }
   
plugin.disable =
function _disable() {
    client.commandManager.removeCommands(plugin.commands);
    return true;
   }

//This function will restore all variables to their default setting.
   function cmdRestoreDefaults(e) {
	apbgamepath = "C:\\Program Files(x86)\\W3D Hub\\games\\apb-release\\game.exe";
	tsrgamepath = "C:\\Program Files(x86)\\W3D Hub\\games\\tsr-release\\game.exe";
	artestpath = "C:\\Program Files(x86)\\W3D Hub\\games\\ar-testing\\game.exe";
	tsrtestpath = "C:\\Program Files(x86)\\W3D Hub\\games\\tsr-testing\\game.exe";
    process1 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
	process2 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
	process3 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
	process4 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
	file1.initWithPath(apbgamepath);
	file2.initWithPath(tsrgamepath);
	file3.initWithPath(artestpath);
	file4.initWithPath(tsrtestpath);
	process1.init(file1);
	process2.init(file2);
	process3.init(file3);
	process4.init(file4);
	connection1 = "178.162.193.144:9016"; //APB Default IP and Port	
	connection2 = "178.162.193.144:9215"; //TSR Default IP and Port	
	connection3 = ""; //AR-Testing Default IP and Port	
	connection4 = ""; //TSR-Testing Default IP and Port	
    display("Default settings restored!");
   }
//This function displays a list of servers you can join.
   function cmdServerList(e) {
	   display("This plugin can join the following servers: APB (/apb), TSR (/tsr), AR-Test (/art), TSR-Test (/tsrt). You must include a player name after the command. (i.e. /apb yourname) You can also type /edit to edit the server information in any of the above servers. If your game path is different than the default install path, you can change it by typing in /[game]path (i.e. /apbpath). You can also restore the default settings by typing /restore.");
	   return true;
   }  
//This function will edit the game path of APB.
    function cmdEditAPBPath(e) {
    apbgamepath = prompt("Please enter your full A Path Beyond path.", "");
    process1 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
    file1.initWithPath(apbgamepath);
    process1.init(file1);
    return true;
    }
//This function will edit the game path of TSR.
    function cmdEditTSRPath(e) {
    tsrgamepath = prompt("Please enter your full Tiberian Sun Reborn path.", "");
    process2 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
    file2.initWithPath(tsrgamepath);
    process2.init(file2);
    return true;
    }
//This function will edit the game path of AR-Testing.
    function cmdEditARTestPath(e) {
    artestpath = prompt("Please enter your full Apocalypse Rising Test path.", "");
    process3 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
    file3.initWithPath(artestpath);
    process3.init(file3);
    return true;
    }
//This function will edit the game path of TSR-Testing.
    function cmdEditTSRTestPath(e) {
    tsrtestpath = prompt("Please enter your full Tiberian Sun Reborn Test path.", "");
    process4 = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
    file4.initWithPath(tsrtestpath);
    process4.init(file4);
    return true;
    }
//This function will edit a server that is built into this script.
   function cmdEditConnect(e) {
       var svr = prompt("Please type a server to edit.", "");
       if (svr == "apb") {
           connection1 = prompt("Please type an IP and port like: xxx.xxx.xxx.xxx:xxxx.", "");
       }
        if (svr == "tsr") {
           connection2 = prompt("Please type an IP and port like: xxx.xxx.xxx.xxx:xxxx.", "");
       }
        if (svr == "art") {
           connection3 = prompt("Please type an IP and port like: xxx.xxx.xxx.xxx:xxxx.", "");
       }
        if (svr == "tsrt") {
           connection4 = prompt("Please type an IP and port like: xxx.xxx.xxx.xxx:xxxx.", "");
       }
       else {
           display("The server you entered is not detected with this launcher plugin.")
       }
           return true;
   }
//This function launches APB and connects you to the official server.
   function cmdLaunchAPBServer(e)    {
    display("Launching A Path Beyond");
    //player name was seperated from +netplayername because it was adding a " at the end of the name oddly
    var args = ["+connect",connection1,"+netplayername",e.name]; //ARGUMENTS BEING PASSED TO THE FILE BEING RAN
    process1.run(false, args, args.length); //actual running of the file
    return true;
   }
    //This function launches TSR and connects you to the official server.
    function cmdLaunchTSRServer(e)    {
        display("Launching Tiberian Sun Reborn");
        //player name was seperated from +netplayername because it was adding a " at the end of the name oddly
        var args = ["+connect", connection2,"+netplayername",e.name]; //ARGUMENTS BEING PASSED TO THE FILE BEING RAN
        process2.run(false, args, args.length); //actual running of the file
        return true;
    }
    //This function launches AR and connects you to the testing server.
    function cmdLaunchARTestServer(e)    {
        display("Launching Apocalypse Rising Test Build");
        //player name was seperated from +netplayername because it was adding a " at the end of the name oddly
        var args = ["+connect", connection3,"+netplayername",e.name]; //ARGUMENTS BEING PASSED TO THE FILE BEING RAN
        process3.run(false, args, args.length); //actual running of the file
        return true;
    }
    //This function launches TSR and connects you to the testing server.
    function cmdLaunchTSRTestServer(e)    {
        display("Launching Tiberian Sun Reborn Test Build");
        //player name was seperated from +netplayername because it was adding a " at the end of the name oddly
        var args = ["+connect", connection4,"+netplayername",e.name]; //ARGUMENTS BEING PASSED TO THE FILE BEING RAN
        process4.run(false, args, args.length); //actual running of the file
        return true;
    }
//This function authenticates the user automatically when they join a server that they are a moderator in.
   function cmdAuth(e) {
	   return true;
   }

 

Link to comment
Share on other sites

@Einstein Would you know what's up here since it's MSDN stuff? The problem is line 43, with the nsIProcess.init() code. It keeps throwing an exception saying the file does not exist, but the file is created just a few lines above--and even initialized.

Link to comment
Share on other sites

I might look more into this later, but a quick google reveals that its probably some sort of syntax error when using the double quote (") character. It all looks correct though.... It could also be something throwing a fit about the blank bits you have (though I wouldn't think it would care about that either being as its initialized to NULL). I'll look more when I'm not sleepy :p

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...