Mojo

Set Text Editor

Edit your scripts easily with your favorite text editor and Mojo for Dark Age of Camelot (DAOC).

The instructions on this page tell you how to use a really nifty feature that makes writing scripts much easier. If you find this page confusing, don’t worry, this feature is hard to explain but very easy to use. If you have trouble, ask for help in Mojo’s forum or Discord channel and somebody will help you.

When you load a script that contains a mistake, Mojo displays an error message. If you click “Edit” on that message, Mojo will open the script in your favorite text editor with the cursor on the spot that needs to be fixed. Here’s a sample error message. Note the button in the lower left corner:

Mojo
Sorry, your script can’t be loaded
Near this location in your script:
Line 8, column 10 in script.txt
         ↓
sendto ( Hotkey )
Mojo found the following (may be the name of a symbol):
hotkey
“hotkey” is one of Mojo’s commands or keywords. That means it has a special meaning to Mojo. Capitalization doesn’t matter to Mojo. If you want to use the word for other purposes, as you are doing here, you must put it in quotes like this:
"hotkey"
[cHotkeyParser__get_defaults.cpp]
Edit
Set editor
Close

But to make this work, you have to give Mojo two pieces of info:

  1. The path to your text editor’s executable file, and

  2. The command line arguments you want Mojo to give to your editor.

You provide this info on the Set Text Editor window (screenshot below).

To help with the second piece of info, Mojo allows you to write three macros:

{line}. Mojo replaces this with the number of the line that contains the start of the error.

{column}. Mojo replaces this with the column of the character where the error starts.

{path} Mojo replaces this with the path of your script. Some text editors call this the “filename” or “file”.

How Do I use the three command line macros?

You figure out how to use the command line macros by reading the instructions for your text editor. For example, suppose you use Microsoft VS Code as your text editor. You would look at VS Code’s instructions for command line arguments. Here they are:

The part I circled in orange means that you enter the following in Mojo’s Set Text Editor window:

-g {path}:{line}:{column}

If this seems too complicated to understand, don’t worry. You can ask for help on Mojo’s forum or Discord server and somebody will show you how to do it with your text editor.

Examples

Some examples will help make this clear. Suppose your text editor is Notepad++ and you’ve installed it to the default directory. Your “Set text editor” window will look like this:

Mojo
Set text editor
When you load a script that contains a mistake, Mojo displays an error message. If you click “Edit” on that message, Mojo will open the script in your favorite text editor with the cursor on the spot that needs to be fixed. But to make this work, you have to fill in the fields below.
For instructions, click “More info about this.”
Path to editor
C:\Program Files (x86)\Notepad++\notepad++.exe
...
Command line arguments
{path} -c{column} -n{line}
More info about this
Save
Cancel

With Atom, you’ll enter something like this. You’ll have to change the name of the user account:

Mojo
Set text editor
When you load a script that contains a mistake, Mojo displays an error message. If you click “Edit” on that message, Mojo will open the script in your favorite text editor with the cursor on the spot that needs to be fixed. But to make this work, you have to fill in the fields below.
For instructions, click “More info about this.”
Path to editor
C:\Users\Sue\AppData\Local\atom\atom.exe
...
Command line arguments
{path}:{line}:{column}
More info about this
Save
Cancel

With VS Code, you’ll enter something like this. You’ll have to change the name of the user account:

Mojo
Set text editor
When you load a script that contains a mistake, Mojo displays an error message. If you click “Edit” on that message, Mojo will open the script in your favorite text editor with the cursor on the spot that needs to be fixed. But to make this work, you have to fill in the fields below.
For instructions, click “More info about this.”
Path to editor
C:\Users\Joe\AppData\Local\Programs\Microsoft VS Code\Code.exe
...
Command line arguments
-g {path}:{line}:{column}
More info about this
Save
Cancel

This page was first published on May 7, 2020 and last modified on May 9, 2020

Comments