Clan Lord Macro Language Reference

Last updated November 11, 2001

One of the most frustrating things about writing macros for CL is that all the information you need is scattered in three or four different places. I've tried to gather it all together in one place, pillaging with great abandon the official macro documentation (which is no longer updated, unfortunately), the works of Phineas (array declarations), Maenygh (how to include subfolders), the "What's New" pages from DT's official CL site, and resources put together by other kind folks too numerous to mention (which just means I've forgotten their names) who have plumbed the depths and reaches of the macro language.

As you might notice, there are no explanations or examples. This is a quick reference for people who know what they want to do but just can't remember the attribute they want to use or who have an idea and want to see if they're going to have to build a hairy workaround or if the macro language already supports what they want to to do.

So here are all the tidbits in one spot. I hope you find them useful. And, of course, if you find something I've left out, please let me know.

Attributes, Variables, Functions:
$any_click
$ignore_case
$no_override
.letter[n]
.num_letters
.num_words
.word[n]
// This is a comment
@click.name
@click.simple_name
@env.click_interrupts
@env.debug (true/false)
@env.echo (true/false)
@env.key_interrupts (true/false)
@env.textLog
@login
@my.[slotname]_item
@my.name
@my.right_item, @my.left_item
@my.selected_item
@my.simple_name
@random @selplayer.name
@selplayer.simple_name
@text
@textsel
call <function>
goto <label name>
include (include ":folder:macrofile" for subfolders)
label <label name>
message "<text>"
message <variable>
pause <number> \" double quote
\' single quote
\r return
\\ backslash

Keys
Modifiers:
Option Key
option-s "this fails"
option-ß "this succeeds"
OS 9.1 broke option-Fkeys for me. If anyone figures out how to get them to work again, let me know.

If:
if <expression> <comparison> <expression>
<commands>
else if <expression> <comparison> <expression>
<commands>
else
<commands>
...
end if

<expression> may be a variable, test, or a number
<comparison> must be from >,<,<=,>=,==,!=
== means equal to
!= means NOT equal to

Random:
random <option>
<commands>
or
<commands>
or
<commands>
...
end random
<option> can be "no-repeat"

Set local variable:
set <variable name> <value>
OR
set <variable name> <operation> <value>
<operation> must be + - * / %

Set global variable:
setglobal <variable name> <value>
OR
setglobal <variable name> <operation> <value>
<operation> must be + - * / %

Set with concatenation:
set <string> + <string> concatenates a string

Set an array:
set <variable_name>[<number>] <value>
or
setglobal <variable_name>[<number>] <value>

Set a two-dimensional array:
set <variable_name>[<number1>][<number2>]

set <variable_name>[<number1>[<number2>]]

Client commands can be used in macros as well. They are:
Using a sewing kit: * Direction is optional and only applies to stand, walkright, walkleft, and attack. It should be one of the following:
Macros can be fired via AppleScript*:
tell application "Clan Lord v115"
     Do Script "ss"
end tell
This script will cause the macro ss to fire in the client.

*Courtesy of Bones