Macros2d.txt

Return to: Technical Information

Internal Macros

 

Creating UO Macros Offline, by Dubious; Edited by Xena Dragon
updated by Petra Fyde, April 2010

 

Editor’s Note: This article deals with creating internal UO macros.
An internal macro is defined as any macro that is unique to (and internally supported by) Ultima Online and
is useable without the assistance of any outside program.
 

I
f you like or want to use lots of macros (and it’s the only way to go), then you will hate to discover that you are standing around vulnerable while doing so manually after connecting to the game. It doesn’t have to be that way.

What is a Macro?

What is a “macro” you ask? It’s a key combination (key combos) which has been defined in the UO game to “trigger” a command or series of commands. Some of UO’s commands can ONLY be triggered by a macro (such as “bow” and “salute”), so you really need to learn how to create them. Fortunately creating macros is easy, either within the UO game itself or offline.

First, you need to recognize that there are two kinds of macros: UO macros, and Windows macros. UO macros are a part of the game interface, and run within the game. Windows macros run within Windows but outside of the game and game
interface. A Windows macro can run a UO macro, but it can’t substitute for one except possibly for pumping speech. Only UO macros are discussed here.

The default UO macro definitions reside in a file in the UO game directory on YOUR local hard drive (not the UO server) called, oddly enough, “macros2d.txt”.
It’s a text file, which has a mix of ASCII and Unicode characters. Because of that mix, you cannot easily modify it with a text editor such as Notepad or any other regular editor for that matter. To still be able to edit the macros2d.txt file by hand, I suggest you use the UO Macro Editor that comes with the UO Magic Tool by Xena Dragon.

Every UO character has it’s own macros2d.txt file. Whenever you create a new character in UO, a directory on your disk is created. You can find that directory at C:\Documents and Settings\[WindowsUserName]\My Documents\EA Games\Ultima Online Legacy\User Data\[accountname]\[shardname]\[charactername]. The macros2d.txt
file from C:\Program Files\EA Games\Ultima Online 2D Client\ is then copied to the character’s directory, and any changes you make to that character’s macros in-game will be stored in his own private macros2d.txt file. So, if you want to have a set of macros that every character you create will use, edit the main macros2d.txt file and you’re all set.

There is another file called “default.mac” which is initially identical to “macros2d.txt”, but the latter is the one which holds your customizations.
“Default.mac” is there to be copyied over “macros2d.txt” when you press the “reset” button in the “Macros” definition screen. (If you want to confirm this, it’s simple to do: just modify “default.mac” and “reset” your macros. Backup
“macros2d.txt” first unless you want to add all your changes again.)

Understanding The File Layout

The file layout is very simple: no blank lines; each macro begins with a line identifying the key combo which activates it; the game commands each on a separate line; and the definition ends with a separator line of exactly eight (8) “pound signs” (#). For example the default definition of “Open Backpack” (provided by UO in the initial “macros2d.txt” and “default.mac” files) is:

B 1 0 0
Open Backpack
########

Several entries would look like this:

O 0 1 0
Open Configuration
########

X 0 1 0
QuitGame
########

F1 0 0 0
UseSkill Hiding
########

B 1 0 0
Say Honored to see you.
Bow
########

S 1 0 0
Salute
########

Num 8 0 1 0
Say Forward
########

(Note the 4th macro, Ctrl-b, consists of two game commands: the bow action, and “Say”.)

Outside of knowing the game commands which can be used in a macro, the trickiest part is understanding the first, key combo, line. That’s dead easy and logical.
I will refer to the single key you pick to trigger the macro as the “trigger key”. Though entered in the macro in upper case, it always refers to the lower case, or “unshifted” key when pressed. It will become obvious why in a moment.
The three numbers are simple bit-maps: 0 = off (not used) and 1 = on (pressed simultaneously with the defined key). I will refer to these as the “modifier keys”.

The sequence for the key combo line and it’s bit-map is:

Trigger Key, Ctrl, Alt, Shift.

So the default “Open Backpack” macro (key combo: B 1 0 0) is triggered by “CTRL-b”.

Multiple “modifier keys” can be used in combination. You could define “Open Backpack” as any of the following:

“Ctrl-b” (B 1 0 0)

“ALT-b” (B 0 1 0)

“Shift-b” (B 0 0 1)

“Ctrl-Alt-b” (B 1 1 0)

“ALT-Shift-b” (B 0 1 1)

“Ctrl-Shift-b” (B 1 0 1)

“Ctrl-Alt-Shift-b” (B 1 1 1)

Valid keys (tested so far), as recognized by UO macros are:

all the letters (a-z)

all the numbers across the top of the keyboard (1-0)

all function keys (F1-F12)

all numbers on the numeric keypad (Num 1-9)

Keys with special meaning when used at the beginning of the text, either during normal game conversation or in a “Say” macro (each is followed by a required space to have the defined effect):

“; ” (semi-colon) = “whisper” the text to only adjacent tiles.

“! ” (exclamation) = “yell” the text half a screen beyond that displayed.

“: ” (colon) = “emote” the text between “*”s and in emote color.

All work with all the modifier keys, with the exception of the keypad numbers.*

Documenting your Settings

This leads to a related issue: how to document your key combos so you can easily find the macro you need at the moment. How you decide to arrange it is up to you (I use one sheet for function keys and numbers, another for letters), but fitting as much as possible on a page can get to be a challenge. All those “Ctrl-Alt-shift-b” entries will chew up half your available space just to identify the key. The solution I’ve found is to use a symbol for each modifier key. A common notation scheme easy to keep straight is:

“^”=Ctrl, “@”=Alt, and “#”=Shift.

In my diagrams, I prefer to put the trigger key first since that’s what I look for first on the keyboard. I also depict the modifier keys in the same order as the bit-map to reinforce the pattern, and print the legend of “symbol to key” across the top of each page. So the same possible set of key combos for “Open Backpack” could be represented by:

^=Ctrl @=Alt #=Shift

b^ = “Ctrl-b” (B 1 0 0)

b^# = “Ctrl-Shift-b” (B 1 0 1)

b@ = “ALT-b” (B 0 1 0)

b@# = “ALT-Shift-b” (B 0 1 1)

b# = “Shift-b” (B 0 0 1)

b^@ = “Ctrl-Alt-b” (B 1 1 0)

b^@# = “Ctrl-Alt-Shift-b” (B 1 1 1)

Using this scheme, I can easily fit three columns of key combos across a page. I also use “Shift” + the “Open” key combo as the “Close” combo. Therefor “b^” for “Open Backpack” has the companion combo of “b^#” defined as “Close Backpack”.
By listing the “Shift” combo under the un-shifted combo it becomes very easy to see and remember key combos. I also use a “programmable throttle” and define my most commonly used combos to it. With this scheme it’s very easy to define the throttle keys to the “Open” combos and use the “Shift” key in combination with the throttle for “Close”. But, use whatever works for you.

A last bit of advice: When in doubt about whether or not a key combo will work, or how it’s represented in the “macros2d.txt” file, try to create a macro from the game paperdoll “Options” screen and then check the results in your “macros2d.txt” file. Now that you know what you’re looking at, it’s easy to work out.

– Dubious

Mapping to Keypad Numbers

It is possible to map macros to the keypad numbers, however to do so you must turn off ‘Num Lock’. In addition you need to check that the keynames.txt file uses the same description for the keys. To do this, first record a test macro through the paperdoll in game, with Num Lock off. Next open the character’s macro2d.txt file in notepad and find the macro:

########

NUM 1 1 1 0

+S a y t h i s i s a t e s t

In this example the key used is ctrl – Alt – NUM 1 (note the recorded entry in the macro2d.txt file generated the number as NUM – all caps.)
The formatting of this can vary depending on the operating system or the keyboard’s ‘country’ settings. Alternatives are Num or num.
Now find the keynames.txt file in the C:\Program Files\EA Games\Ultima Online 2D Client\ folder. Open this file in notepad and scroll down to the numbers.

This file must have exactly the same name for the keys as that generated in the macros2d.txt file. If they are different, edit this file to match the macros2d.txt file. If the case formatting in the keynames.txt file does not match that generated in the macros2d.txt file, when recording a macro through the paperdoll, the macro will not save.
To simplify: If macros2d.txt shows NUM 1 then keynames.txt must show NUM 1. If macros2d.txt shows Num 1, then keynames.txt must show Num 1. etc.

– Petra Fyde

Last modified: June 15, 2013

Leave a Reply

You must be logged in to post a comment.