MULTIBOXING

Overview

I added multiboxing features to Mojo in autumn 2017. These new features are integrated with Mojo's team launch page and existing Hotkey page.

How does Mojo compare to HotkeyNet? Mojo is much easier to use. I wrote both programs so I have no axe to grind.

The basic idea is that you define hotkeys in a text file with a program like Notepad. The simplest possible hotkey looks like this:

Hotkey ( F1 )
{
   Key ( Backspace )
}

That means, “When I press F1 with my finger, Mojo should make all copies of DAOC peform the action that is bound to Backspace in the game.”

Mojo doesn’t care about capitalization or line endings or spaces so you can write that hotkey like this:

hotkey ( f1 ) { key ( backspace ) }

or even like this:

hotkey(f1){key(backspace)}

Mojo gives you three main commands for controlling DAOC:

Here’s an example of a hotkey that contains all three types of commands. I multiboxed for years and I can tell you that this is one of the most important hotkeys you can make even though it has nothing to do with fighting, healing, or buffing.

hotkey (  NumpadEnter  )
{ 
   description ( "Stick everyone to Ribble" )
	
   slash ( "/target Ribble" )
   wait (150)
   key ( T )
   
   //  don't forget to also make
   //  a hotkey to unstick everyone
}

The description is optional. If you include it, Mojo displays it in the list of loaded hotkeys on its Hotkey page. The slash commmand is in quotation marks because it contains a space. Whenever you write text that contains a space, you must use quotation marks. Ribble is the name of one of my toons. The 150-millisecond delay is there because we can’t take the next action until the /target commands travel over the Internet to Broadsword’s server and notifications return from the server telling our toons that they have acquired the target. You may need a longer or shorter delay depending on your Internet connection and distance from Broadsword’s server. The key T is bound to /stick on my copies of DAOC. Everything after // on the same line is a comment for your eyes only. Mojo ignores comments. You can write multiline comments with /* and */ symbols.

Hotkey files

You can include as many hotkeys as you like in a file. I suggest naming your file with a .txt extension to make it easy to open with a text editor. You can load a file into Mojo in either of two ways:

  1. Enter the file location on a Team properties window. This will make the file load automatically every time you launch the team with Mojo.

  2. Or enter the file location at the bottom of the Hotkey page and click Load.

To unload a hotkey file, press Unload at the bottom of Mojo’s Hotkey page. Files unload automatically before you load a new one or reload the same one.

Triggers

You pull the trigger of a gun with your finger. Similarly, the trigger of a hotkey is the key combination you press with your fingers. Triggers can be as complex as you want. Here are some examples:

hotkey ( Shift Alt Ctrl F2 )
hotkey ( NumlockOn F2 )
hotkey ( NumlockOff F2 )
hotkey ( A B C F2 )

That last one may look weird. In that trigger, A B C is used like Shift Alt Ctrl. This is sometimes called a keyboard chord. If you use ordinary keys in this way, as modifiers, you have to make sure that those keys don’t cause any actions on their own.

When you specify keys in a trigger, you must write the names of the keys. The names of letters and numbers are obvious (R, G, 5, 9, etc.) but other keys are not obvious (NumpadDelete, MediaSelect, VolumeUp, etc.) To learn the name of a key, press it while looking at the upper left corner of Mojo's Geeky Stuff page.

For more information about triggers, go here.

When does a hotkey get triggered?

By default, a hotkey gets triggered no matter which window is in the foreground. But what if you want a hotkey to work only when you're in DAOC? In other words, what if, for example, you want the hotkey to be disabled when you're clicking on webpages? Here’s how you do it:

hotkey (F7)
{
   foreground ( daoc )
   slash ( "/say Hi boys and girls." )
}

That foreground command means, “Execute this hotkey only when DAOC is the active window.” If you want the opposite behavior -- in other words, if you want hotkeys to always execute no matter what window is in the foreground -- you can write foreground (any) but any is the default so you don’t have to bother. Just omit foreground completely and you'll get any automatically.

Which DAOC receives which commands?

By default, hotkeys send commands to all DAOCs launched by Mojo on all your networked computers. But what if you want to control which windows receive which commands? For this purpose you use packages.

For example, suppose you have three DAOC windows on your networked PCs named Eenie, Meenie, and Moe. We can send different commands to each one with package and sendto. For example:

hotkey ( Numpad5 )
{
   package
   {
      sendto ( Eenie )
      slash ( "/say I'm Eenie" )
   }
   
   package
   {
      sendto ( Meenie )
      slash ( "/say I'm Meenie" )
   }
   
   package
   {
      sendto ( Moe )
      slash ( "/say I'm Moe" )
   }
}

Sendto is the package’s address label. In this example it contains the names of toons. It tells Mojo which DAOC windows should receive the package.

You can identify windows with names of toons, as shown here or in other ways. Here’s a complete list of things you can write after Sendto to identify windows. You can write as many of these things as you like in a single Sendto statement.

toon’s name
window name
account name
computer name
IP address

You can also write these special keywords:

all
local
remote
local_background
local_foreground

All is the default so there’s no reason to bother writing it. You can combine these terms like this:

Sendto ( local_background 
   192.168.1.3 Eenie Meenie "DAOC 3" )

Something that confuses many people

The keys used in triggers and the key command are virtual keys defined by the operating system. They are not the same as the plastic objects on your keyboard.

For the most part, each plastic key on your keyboard corresponds to a single virtual key. For example, the Backspace key on your keyboard (the plastic thing) corresponds to the Backspace virtual key. This is totally simple and usually you don’t have to think about it.

However, not all keys are that simple. For example, most of the plastic keys on the number pad send two different virtual keys depending on whether NumLock is on.

For example, when NumLock is on and you press this plastic object in the lower right corner of your keyboard,

.
Del
it sends the Decimal virtual key to the operating system. But when NumLock is off, that same plastic object sends the NumpadDelete virtual key. That means the following hotkeys are different even though you trigger both of them by pressing the same piece of plastic. One hotkey gets triggered when NumLock is on, the other when it’s off:
hotkey ( Decimal )
{
   slash ( "/say I'm the decimal key" )
}

hotkey ( NumpadDelete )
{
   slash ( "/say I'm the NumpadDelete key" )
}

Technical details

You can save hotkey files as ANSI or UTF-8.

Commands are always sent in packages. Package is a term I invented for a bundle of commands that Mojo sends to a DAOC window. All commands you write in the main part of a hotkey, outside a package block, get put into a package automatically by Mojo behind the scenes. For example:

hotkey (alt 9)
{
   key(1)
   
   package
   {
      sendto ( Eenie )
      key (2)
   }
   
   key(3)
}

Mojo makes two packages from that hotkey. The first package goes to all your DAOCs, and it contains Key(1) and Key(3). The second package goes only to Eenie, and it contains Key(2).

After packages get sent to DAOC windows, they execute inside the process of that DAOC window.

Each copy of a package executes in its own thread. That means that if you send two packages to the same window at the same time, they will execute concurrently. Usually this is a bad idea but sometimes you may want to make deliberate use of this. For example:

 hotkey ( ScrollLockOn 7 )
 {
   package
   {
      slash ( "/say 1" )
      wait ( 2000 )
      slash ( "/say 3" )
   }
	
   package
   {
      wait ( 1000 )
      slash ( "/say 2" )
      wait ( 3000 )
      slash ( "/say 4" )
   }
}

That hotkey will make a toon say “1 2 3 4” in order.

You’ve heard of multithreaded programming, right? Now you can do it yourself in a multiboxing script! :)

Keywords

Here’s a list of all keywords other than commands and keys. Capitalization doesn’t matter. Most of these keywords have meanings only inside certain statements.
hotkey
description
package
sendto
any
all
local
remote
local_background
local_foreground

This page was first published on October 26, 2017 and last modified on November 18, 2017