Nexus Help


Table of Contents

1. General Help
Introduction
Features
Getting Started
The Intro Tour
Playing the Game
Main Play Screen
Preferences
When Settings are Saved
2. Advanced Topics
Reflexes
Variables
Aliases
Triggers
Keybindings
Groups
Reflex Editor
I. Built-In Command Reference
#add — Add a number to a variable.
#beep — Sounds the system beep alarm.
#echo — Echo a line of text to the terminal window.
#echo_ — Echo text to the terminal window (without a trailing newline).
#groupon — Enable a reflex group.
#groupoff — Disable a reflex group.
#highlight — Highlight the text matched by the current trigger.
#gag — Remove (gag) the matching line from the output.
#if — Conditionally execute portions of the script.
#math — Perform some math and assign it to a variable.
#openurl — Open a URL in a new browser window.
#send — Send a line of text to the server.
#send_ — Buffer some text to send to the server
#set — Set a variable's value.
#unset — Delete a variable.
#wait — Wait a given amount of time before continuing.

List of Tables

2.1. Trigger Pattern Matching Operators

Chapter 1. General Help

Introduction

Welcome to the Nexus client's help file. This document is intended to give you all the information you need to get to know and to effectively use Iron Realm Entertainment's latest MUD client program, Nexus. Nexus is a cross-platform application written in Java (http://www.java.com) that can be embedded in most modern browsers. The goal is to provide a rich interface to the complex world of text mudding.

If you're an existing text mudder, you've most likely used a MUD client before, such as Zmud, TinyFugue, Portal, or Rapscallion (or just plain old Telnet). A MUD client provides a user-friendly way to enter text commands, read the resulting output, and usually to provide some automation through pattern matching and scripting. Nexus provides all of these, and more!

Features

Nexus is improving all the time, and the list of features is just going to get better and better. Currently, it supports the following common MUD client features:

  • Command editing/preview (with option to "keep last command").

  • ANSI color support.

  • Scripting support: triggers, variables, aliases, keybindings.

  • Scripting groups.

  • Anti-aliased fonts.

  • Prompt gagging.

  • Telnet negotiation.

  • Cross-platform (Windows, Mac, Linux, etc).

  • Command history.

  • Terminal background images.

However, some of the neatest features are specific to Iron Realms games:

  • Current location information displayed in the skin.

  • Clickable room exit indicators.

  • Current vitals such as health and mana displayed graphically.

  • A composer for editing in-game files locally.

  • Settings saved on the server.

  • Graphical character creation.

  • Skinnable graphics.

Getting Started

The easiest way to get started playing is to go to any Iron Realms game website and click the large "Play Now" button located on the front page. This should open a new window with the Nexus client and begin downloading and running Nexus in applet mode.[1]

Once Nexus has been downloaded by your browser (this takes a bit on slower connections), it should initialize and begin downloading any extra data it might need (such as the skin's graphics) and displays a progress bar showing this process. Finally, a login screen should appear in which you may type your existing character's name and password to login or you may create a new character using the button provided.

After logging in (or creating your new character), you'll be brought to the main play screen, where you will spend the majority of your time.

The Intro Tour

All IRE games have an interactive tour, which is not part of Nexus, but is worth mentioning here, because it does provide a very helpful way to get to know the game and become familiar with using Nexus to interact with the myriad of creatures and players around you. You are asked whether you would like to take the tour after you create your first character.

Playing the Game

Once you've downloaded Nexus, and either logged in or created your character, you'll begin playing the game. This section describes some of the major client elements and features that will help you in your adventures.

Main Play Screen

Once you login or create your character for the first time, you will be presented with a large text screen and a smaller command entry box (though they will likely be in pretty graphical surroundings). This is the main play screen, and these two boxes are your main interface to the game world. The larger window tells you about things going on in the world, such as people around you saying something or monsters attacking you. The smaller box is where you type your commands to do things within the game (such as reply to someone who's talking to you, or to kill the monster that's attacking you).

Let's look at the main play screen in more detail and explain some of the things you'll be using:

In the above screenshot, which may look different depending on your game (the above is for Achaea, Dreams of Divine Lands), various features of interest are highlighted:

  1. An out-of-sync indicator. This is visible when settings have been changed on your machine and not yet copied to the server for safe keeping. Any changes made before this icon disappears will not be remembered the next time you play.

  2. Connection quality/speed indicator. This bar displays your current average connection speed to the game server. Good connections are generally green, decent connection speeds are yellow, and bad speeds are red or black. Many external factors may affect your connection.

  3. Trigger enable/disable. This icon indicates whether triggers are currently being matched. Click it to toggle the option on or off.

  4. Script evaluation. This controls whether command entered in the command entry box are interpreted as scripts or simply sent to the game as plain text. Note: this does not disable keybindings or triggers. It simply prevents the commands typed from being interpreted as script.

  5. Terminal window. This is the main output from the game. When anything happens to you, you'll generally read it here. It also echoes the commands you submit when you do so, as well as displays your prompt.

  6. Current location. This bit of text is dynamically updated as you move around in the game and reflects your current place in the world, be it a deep dungeon or just the local newsroom.

  7. Command entry box. This is where you enter commands for the game. When you want to attack something or kiss your sweetheart goodbye, you would type the command here. There are literally thousands and thousands of commands to choose from, so be sure to check the game's help files for more information.

  8. Vital stats. Here your stats, such as health and mana are reported as a colored bar. As you are hurt or healed, these bars will increase or decrease to show that status. Power-players generally also enable seeing vitals in their prompt, as the player above has opted to do.

  9. The Compass. This compass-like indicator shows the obvious exits from your current location. If an exit can be taken, it will light up and you can either click on it to walk in that direction, or type the corresponding walk command (e.g. "north" or just "n", to walk north).

Preferences

Nexus lets you change many of the major features to suit your particular play style. Most of these can be accessed through the preferences window, which is opened by clicking on the button in the main play screen. Let's go over the major settings and what they do.

Terminal Font Size

This determines the size of the font of the large terminal widget on the main play screen. Nexus is smart enough, however, to make sure you can at least fit 80 characters on a line of text, and will automatically scale your font up or down to make sure you can read a full line of 80. (If you change the font size and nothing appears to happen, this is likely the case.)

Terminal Font Smoothing

The font used in the terminal widget can be 'smoothed' (or anti-aliased) if your version of Java supports this feature. Most users prefer this option, and it is enabled by default.

Terminal Background

Nexus comes with a variety of background options for the terminal widget to provide an easy-to-read environment (as you'll be doing lots of it!). The backgrounds are chosen to provide a good reading surface for most of the colors used in the game, but if none of them suits you, there is always the plain solid black background to choose from.

Gag Prompt

If enabled, this will prevent the prompt from appearing in scrollback if you have not entered anything on that prompt's line. Casual users appreciate the cleaner blank lines between text snippets sent from the server, but combatants like having their prompt (which contains valuable information) spammed at them as much as possible.

Keep Last Command

Usually, the command entry box will clear its contents after every command you type. You may enable this option to have it retain the last entered command and pressing enter will re-send it (or type anything new to erase it and start fresh).

Use Composer Window

IRE games have an in-game editor that works well, but most users prefer the easier text editing capabilities of the GUI composer window. When enabled, all composer sessions in the game will be done via this graphical composer window, otherwise the standard text-based one is used.

The preferences window also displays extra information about both your connection and your specific version of the client. Near the top, your character name is displayed (as well as what server and Internet port you're using to connect to the game). Elsewhere, your client build and current Java version are reported. These settings are not changeable, however, they are simply determined from the environment in which Nexus is running.

When Settings are Saved

Because settings (and reflexes) are saved to the server, but they can often be changing quite frequently (due to reflexes that modify other reflexes, etc), Nexus uses a timer to detect and save these changes. The timer goes off approximately every two minutes and if any changes have been detected, they will be committed to the server at this time (assuming you're still connected of course!). To help you know when this has taken place, an indicator shows up in the main play screen to tell you when your settings have been changed, but not yet committed to the server for safe-keeping. Keep an eye on this, or any changes you make may be lost if you quit before they have been saved.



[1] Applets are "mini applications" that run with restricted permissions to protect your computer. This currently prevents Nexus from reading or writing files to your machine or to access your system clipboard (among other things).

Chapter 2. Advanced Topics

Reflexes

Reflexes are what Nexus collectively calls all of its scripting and automation elements. When you create an alias and a trigger, and maybe use a variable or two, you're creating a set of reflexes. They are generally intended to make your life easier by performing some mundane maintenance task or by creating a fast-paced twitchy combat system to more easily defeat foes one-on-one.

Variables

Variables are probably the simplest type of reflex. They simply hold data for use in other reflexes (or in the command entry box). For example, say you have a favorite backpack in the game. Its unique number is "pack123456", but that's a lot to remember (let alone type)! It's easy to create a variable, say, "pack", and just use that in commands instead. So, for example, you can create a variable by typing:

#set pack pack123456

into the command entry box. This creates the variable "pack" and stores the given value in it. You can then access it using the "expansion form" of that variable in any script or command. So now you'd like to put some cheese you've purchased from the local store into your favorite pack. Once you've set your variable, you could do:

put cheese in $pack

Note how the dollar sign in front of the variable name "pack" makes the variable expand into its corresponding value. The text actually sent to the game would be:

put cheese in pack123456

which is what you would have typed without using a variable. Now, the above example is a very simple one. Often, variables are used quite cleverly to change which thing is being used without changing any commands or scripts that reference it. Say you've got a room full of rats that you're trying to kill. You've also set up an alias (another type of reflex) that will automatically send "kick $rat". You could set the "rat" variable to a specific one, and any script using that variable will automatically point to the correct rat. Using variables cleverly is the key to powerful reflex scripting.

Aliases

Aliases (you may be more familiar with the term 'macro') are one or more commands that can be executed by using an abbreviation or symbolic name. This is easier than it sounds. Let's see a neat example of an alias that will get a key, unlock a door, open it, move through it, then close and lock it again, and finally put your key back in your pack for later (a lot of typing, especially if you do it often!).

get key123 from $pack
unlock door east
open door east
east
close door west
lock door west
put key123 in $pack

This alias performs all of that and we can store it using a friendly name like "enterhouse". That way, when we stand outside our house, we can just enter one command:

enterhouse

and all of the above commands are executed for us. Neat!

Aliases are super-helpful at reducing the amount of typing we need to do, but they have another powerful feature: arguments. Arguments (or parameters, if you prefer that term) are optional bits that can change how an alias executes commands based on how it is invoked. Let's see another example. This time, an alias (we'll call it "whack") to perform a series of attacks on a target of our choice.

sdk $1
ucp $1
ucp $1

This alias is set to perform a sidekick, and two uppercut punches on a single target. Note, the argument is a number. In this case, it references the first argument (note the resemblance to variables). Aliases can have any number of arguments, and each is stored in-order using the number to reference it. So, let's say we're killing that poor defenseless rat from before. We could simply type:

whack rat123

or, being even more clever, we could use our saved rat variable from before:

whack $rat

Triggers

Triggers are the pattern-matching scripts available in Nexus. It scans text as it is received from the server, and attempts to match it against a specific pattern. If the pattern matches, then the script is run. It's pretty simple. Let's say, for example, that you want to automatically remember who the last person to give you a tell is. We'll use a trigger to update a variable so it will be available later. We create a trigger for the following text (this may be different for your specific game):

{w} tells you, "{*}"

You'll see two pattern matching bits in there. The first, "{w}" tells Nexus to match any 'word' (word, in this case meaning a sequence of one or more non-whitespace characters); the second, "{*}" matches any text at all (maybe even none at all!) that comes between the two quotes that surround it. And for the script part of that trigger, we'll update our variable to store who was the last person to tell you something (and heck, we'll also save what it was they said.).

#set last_teller $1
#set last_tell $2

So, for instance, if Gronk were to tell you something:

Gronk tells you, "Wow, that was awesome! I'm humbled by your prowess."

Your trigger (if triggers are currently enabled), will recognize this text and set the last_teller to "Gronk" (without the quotes) and last_tell to "Wow, that was awesome! I'm humbled by your prowess." You'll notice that the patterns that were matched get put into the numeric-style arguments $1, $2, etc (just like aliases have arguments). This way you can actually do something useful with them in your script if you like.

Now, keep in mind that a trigger defines an entire pattern to match, and it is matched all at once. It must match the entire thing for it to fire its script (not just a part). So keep this in mind when making triggers.

The following is a list of the patterns and what they match[2]:

Table 2.1. Trigger Pattern Matching Operators

{w}Match one or more non-whitespace characters (a 'word')
{d}Match one or more numeric digits (a number)
{[abc]}Match one or more of either 'a', 'b' or 'c'. (a character class)
{[^abc]}Match one or more of anything EXCEPT 'a', 'b', or 'c'
{*}Match zero or more characters (anything)
{<}Match the beginning of a line (not the actual newline character)
{>}Match the end of a line (not the actual newline character)

Triggers are often used to save matched parts into variables. This occurs so frequently, that we have provided a shortcut for doing it. If you include a variable name inside the matching operator, separated by a colon (':') character, then it will automatically save that match into that variable. So, the above trigger could be rewritten with no scripting part at all, like so:

{w:last_teller} tells you, "{*:last_tell}"

Isn't that neat? The other useful thing that triggers are normally used for is to change the color of text that's received from the server. Players often use this to highlight important things like a friend or enemy's name, or a special affliction message that they know must be cured quickly. By including the #highlight command in a trigger, you can easily change the color of any matched trigger.

Triggers are often the most CPU-intensive part of playing a game, since if you have many triggers, it must scan the input text many times in order to find every single one that matches. If Nexus begins to feel slower than normal, you can try and increase the performance by:

  1. Deleting unnecessary triggers.

  2. Using groups to enable/disable triggers that are not likely to be used at the moment.

  3. Provide line beginning and ending hints (searching across multiple lines can often be quite intensive).

  4. Use something more specific than {*} if possible. Matching any character (or even none) is the most expensive thing to match, so if you know it's going to be a single word or a digit, use the special form, because not only is it safer[2], it's faster too!

Keybindings

Keybindings are simple to understand. They work just like aliases (that have no arguments) and are fired when a particular key combination is pressed. Instead of typing out "whack" every time we want to perform an attack combo, we could bind it to "Ctrl+W" and then, every time we pressed that key combination, it would execute the script.

Almost all keys can be bound (or rebound) in this way. The rule is generally that you must have one or more of the "meta" keys pressed in conjunction with any 'normal' key. Meta keys are "Control", "Alt", or "Shift". When in doubt, the reflex editor will only permit you to bind valid keys, so no worries there!

Groups

Often, as you increase the number of reflexes that you use, it becomes necessary to not only organize them into manageable groups, but to enable and disable them as well. Every reflex element has a group associated with it (even if it's just the 'default' group). This group can be enabled or disabled using the #groupon or #groupoff built-in functions. You can also use the group to change what is displayed in the reflex editor (but see that section for more information on doing this). So, perhaps you have a set of triggers and variables that deal with creating things in your forge. You put all of these in a "forging" group, and then you can turn it on and off when you begin and end forging.

Reflex Editor

The reflex editor is a special control that can be accessed by opening the preferences window and selecting the "Reflexes" page. Use it to list, create, edit, and delete reflexes of any type. Let's take a quick look at what this looks like:

On the left, we see a listing of our currently defined reflexes: a variable named "target", an alias called "whack" (that is currently selected and being viewed), and a keybinding for "Ctrl+W". Were we to type some text into the filter field just above this list, it would automatically shorten the list to only those reflexes that match the filter text (useful when you're dealing with large lists). Alternately, we could select a different group from the drop down box at the top, and see only keybindings for example, or maybe only the reflex group "forging" (though in this case we don't have any reflexes in that group).

If we want to create a new reflex, we can press the big button[3] which will give us a choice of which reflexes to create. It's a simple matter of filling it in and saving it after that.

To delete a reflex, simply select it from the list and press the Delete key.

Editing a reflex is as simple as picking it from the list, changing one of the values, and clicking the smaller "Save" button. Changes are not complete until you press save, at which point your current reflex will be ready to use (and will be remembered when your reflexes are next saved to the server).



[2] It's possible to construct dangerous triggers. When using the {*} pattern, it will match anything. This is especially dangerous if you use that matched text to perform any actions. Other players are quite clever, and a well-constructed tell or say (if they know you're using a dangerous trigger) will leave you open to quite harmful things. For example, you should never simply execute whatever someone says to you. Trig:

{w} tells you, "{*}"

with a script of:

$2

Imagine the possibilities:

Gronk tells you, "GIVE GOLD TO GRONK"

All of a sudden you've given all of your gold away!

[3] As a shortcut, if the reflex list is currently selected, you can use the following keys to create new reflexes: Ctrl+V = new variable, Ctrl+A = new alias, Ctrl+T = new trigger, and Ctrl+K = new keybinding.

Built-In Command Reference


Table of Contents

#add — Add a number to a variable.
#beep — Sounds the system beep alarm.
#echo — Echo a line of text to the terminal window.
#echo_ — Echo text to the terminal window (without a trailing newline).
#groupon — Enable a reflex group.
#groupoff — Disable a reflex group.
#highlight — Highlight the text matched by the current trigger.
#gag — Remove (gag) the matching line from the output.
#if — Conditionally execute portions of the script.
#math — Perform some math and assign it to a variable.
#openurl — Open a URL in a new browser window.
#send — Send a line of text to the server.
#send_ — Buffer some text to send to the server
#set — Set a variable's value.
#unset — Delete a variable.
#wait — Wait a given amount of time before continuing.

Name

#add — Add a number to a variable.

Synopsis

#add <variable name> <expression>

Description

This will add a certain amount to the variable specified here. If it's not a number, then it will be treated as 0 for purposes of doing math. The final result is stored into the variable as the new value. For example: #add foo 3 will add 3 to the current value of 'foo' and store it (back in 'foo').

Example

#add counter 1                        // Add one to the variable 'counter'.
#add friends -1                       // Subtract one from the variable 'friends'.
#set total = 0                        // Reset a total price
#add total $price1                    // Add in a few prices...
#add total $price2
#add total $price3
#echo Total: $total                   // Print the total result to the screen.
#echo Total: $($price1 + $price2 + price3) // Alternate way of printing the total price.

Name

#beep — Sounds the system beep alarm.

Synopsis

#beep

Description

Use this command to cause the default system beep to sound. Your system must have a default beep sound enabled for this to work, however.

Example

#beep                                 // Sounds the system bell.

Name

#echo — Echo a line of text to the terminal window.

Synopsis

#echo <text>

Description

This will print some text to the terminal window in a special 'output' color.

Example

#echo My stats: $hp/$maxhp            // Echoes an informational message to the screen.

Name

#echo_ — Echo text to the terminal window (without a trailing newline).

Synopsis

#echo_ <text>

Description

This works just like #echo, except it doesn't print a newline after the end of the text. Usually you'll want to use the non-continuing form of echo. It's easier and more straightforward to use.

Example

#echo_ My stats:                      // Echo some text.
#echo_ $hp                            // Echo your current hp, stored in 'hp'.
#echo_ /                              // Echo the text "/".
#echo_ $maxhp                         // Echo your maximum hp, stored in 'maxhp'.
#echo                                 // Output a newline at the end.

Name

#groupon — Enable a reflex group.

Synopsis

#groupon <group name>

Description

This will enable one or more reflex groups. When a group is disabled, triggers will not fire, aliases and keybindings will not work, and variables will pretend to be non-existent.

Example

#groupon curing                       // Enable the 'curing' reflex group.
#groupon combat                       // Enable the 'combat' reflex group.
#groupon $mygroup                     // Enable the reflex group whose name is stored in 'mygroup'.

Name

#groupoff — Disable a reflex group.

Synopsis

#groupoff <group name>

Description

This will disable one or more reflex groups. When a group is disabled, triggers will not fire, aliases and keybindings will not work, and variables will pretend to be non-existent.

Example

#groupoff curing                      // Disable the 'curing' reflex group.
#groupoff combat                      // Disable the 'combat' reflex group.
#groupoff $mygroup                    // Disable the reflex group whose name is stored in 'mygroup'.

Name

#highlight — Highlight the text matched by the current trigger.

Synopsis

#highlight <color>

Description

When used within a trigger body (or in some other script called by a trigger), then this will change the color of the text matched by that trigger to the color(s) specified here. Color schemes may be "<foreground>" or "<foreground> on <background>" style strings. The color can either be specified in the RGB web-format with the leading # omitted. For example, 00ff00 is green. Some colors are pre-defined for you. These include:

  • "black"

  • "red"

  • "green"

  • "yellow"

  • "blue"

  • "magenta"

  • "cyan"

  • "white"

  • "grey"

  • "bold black"

  • "bold red"

  • "bold green"

  • "bold yellow"

  • "bold blue"

  • "bold magenta"

  • "bold cyan"

  • "bold white"

Example

#highlight "red on yellow"
#highlight "blue"
#highlight "e0e0e0"
#highlight "c0ff00 on 004000"
#highlight "bold magenta on green"

Name

#gag — Remove (gag) the matching line from the output.

Synopsis

#gag

Description

This will remove the matching line(s) from the client output, so that you will not see them. This can be used to hide unneeded text, so that you can focus on important bits of information, especially in combat situations.

The whole line is always hidden, even if your trigger only matches a portion of the line.

Example

#gag                      // Gag the matching line.

Name

#if — Conditionally execute portions of the script.

Synopsis

#if <condition> <text>

#if <condition> { <script> }

#if <condition> { <script> } else { <script> }

#if <condition> { <script> } { <script> }

#if <condition> { <script> } elsif <condition> { <script> }

#if <condition> { <script> } elsif <condition> { <script> } else { <script> }

Description

The if statement is basic element of complex script writing. It provides the ability to execute one or more statements based on the value of some condition (such as a variable being greater than X). The if statement comes in many different forms, as evidenced by the synopsis above. Each one means something slightly different, but does not deviate from the single purpose: to execute some statements (or an alternate set of statements).

A condition is any expression that evaluates to true or false. In Nexus, true is anything other than "", "0" , or 0. Anything non-zero or a string with a length greater than 0. The opposite is of course what we consider 'false' (0, or ""). Conditions can be as simple as a single variable's value (e.g. $foo), a test of its value against a known quantity (e.g. $foo > 5), or a complex combination of "sub-expressions" (e.g. $foo > 5 and $bar < 10 or $somevar = 15).

In if statements, if the condition evaluates to true, the first 'branch' is taken and those statements or bits of script are executed. If the if (pardon the pun) has an 'else' clause, then it will be executed only when the condition is false. In this way, you can choose which path the script will take. If it's true, it will do A, if not, then B (but the B part is optional). It's also possible to chain ifs together in sequence: If A { do some stuff } elsif B { do some other stuff } else { do this stuff if nothing else was true }. This becomes a lot more clear with some examples.

A couple more things need to be said about if statements. You'll notice the {}'s in the synopsis of usage; these braces are used to group 'blocks' of script together into logical groups. When you 'branch' into a 'block' all of those statements are executed (or not) depending on whether that branch was taken. (Also, you could actually have nothing in the braces (e.g. { }) and that's valid. It means do nothing.) All of the forms of #if use curly braces to denote script blocks unambiguously except for one. The only form that doesn't is really just for convenience since it's often desirable to simply prefix a single line of action with an if to do it conditionally. In this case, it's easier to omit the braces. However, doing so precludes having an elsif or else clause.

It is important to note that script blocks may span more than one line as long as the opening curly brace ('{') is on the same line as the if/elsif/else clause, and the closing brace continues the original if statement as if it was on the same line. Whew, that's a mouthful! What this means, is that you're free to put script blocks on more than one line, but the actual statement those blocks are in must remain on the same logical line. (Don't worry, there are examples of this below.)

[Warning]Warning

If statements and conditions are relatively new additions to the Nexus scripting language, so it may be possible to encounter a bug (especially in very complicated combinations of and and or and comparsions) despite thorough testing by the development team. If something behaves unexpectedly, please file a bug report describing the bug (include the relevant portion of your script and describe what it does and how that's different what you think it should be doing).

Example

// If $foo is true, echo that fact.
#if $foo #echo Foo is true!          // If $foo is true, echo that fact.

// A slight modification of the above that illustrates an 'else' clause.
// The second form shows that the word 'else' is actually optional too.
// (The two lines are functionally the same.)
#if $foo { #echo Foo is true! } else { #echo Foo is false! }
#if $foo { #echo Foo is true! } { #echo Foo is false! }

// Illustration of putting more than one statement in a block (also
// spans lines here). Note the if doesn't end until the last '}' is
// encountered.
#if $foo {
   #echo Foo is true!
   #echo Isn't it grand?
   #echo These commands are all on separate lines too!
}

// This shows how ifs continue (on 'logical' lines) even though the
// blocks in its constituent clauses may have multiple lines. The
// following lines are all _one_ single if statement.
#if $foo > 50 {
   #echo Foo is big!
   #echo Yes it is.
} elsif $foo > 10 {
   #echo Foo is pretty big...
   #echo I've seen bigger.
} else {
   #echo Foo is actually kind of small.
}

// Ifs can be nested too.
#if $foo {
   #if $bar {
      #echo Both foo and bar are true.
   } else {
      #echo Foo's true, but bar isn't.
   }
}

Name

#math — Perform some math and assign it to a variable.

Synopsis

#math <variable name> <expression>

Description

This will evaluate the expression and assign the result into the variable specified. This isn't strictly necessary, as it can be accomplished via the #set command, but is provided to help scripters who are familiar with other clients.

Example

#math foo $foo + 1                   // Add one to the variable 'foo' and store it.
#math cost $dollars * 100 + $cents   // Do some more complex math.
#set foo = $foo + 1                  // Equivalent to the first line of this example.

Name

#openurl — Open a URL in a new browser window.

Synopsis

#openurl <url>

Description

This attempts to open a URL (such as http://www.achaea.com) in a new browser window.

Example

#openurl http://www.ironrealms.com     // Open Iron Realms' website in your browser.

Name

#send — Send a line of text to the server.

Synopsis

#send <text>

Description

This will send a line of text to the game as if you had typed it into the command entry box. Usually this is not needed, but can be used if you would like to circumvent the alias system (which is used by default if no built-in command is specified for a given line of script).

Example

#send say hi!                        // Just send some text to the server.
#send aliasedcmd blah                // Note: This won't exapand an alias if it's the first word.

Name

#send_ — Buffer some text to send to the server

Synopsis

#send_ <text>

Description

This will save a bit of text and ready it to be sent to the server. This works just like #send, except it doesn't actually send the text until a #send is used (so you'll need one somewhere, or it will never actually get sent to the server). Generally this isn't needed, but is provided just in case.

Example

#send_ say                           // Begin constructing a command to send.
#send_ $text_to_say                  // Do some more complex math.
#send                                // Need a non-continuing form to actually send it.

Name

#set — Set a variable's value.

Synopsis

#set <variable name> <text value>

#set <variable name> = <expression>

Description

Store a value in the variable with the given name. Note, you're not expanding or referencing the variable here, so you don't include the '$' character, just the name. Also, there are two forms of this command. The first will set the value using the line of text that follows the variable name, the other, takes an actual expression and is evaluated before being stored in the variable.

Example

#set foo 1                           // Set the variable 'foo' to 1.
#set foo 1 + 1                       // Set the variable 'foo' to _the text_ "1 + 1".
#set foo = 1 + 1                     // Set the variable 'foo' to 2.
#set foo = $foo + 1                  // Add one to the variable 'foo'.

Name

#unset — Delete a variable.

Synopsis

#unset <variable name>

Description

Deletes a variable with the given name. Once a variable is deleted, any attempt to reference it will result in an empty value ("") being returned.

Example

#unset foo                           // Clears the variable 'foo' so it no longer stores anything.

Name

#wait — Wait a given amount of time before continuing.

Synopsis

#wait <milliseconds>

Description

This command will simply suspend execution of the script for a given amount of time (1000 milliseconds = 1 second). To avoid spamming the game server (or having it reject your commands because they are coming too quickly), you can easily delay sending of commands.

You must use care when using any time-delayed command, however, because there are a couple of pitfalls you need to avoid:

  1. Variables may have changed by the time this script begins executing again (because another script may have changed it in the meantime). So if you rely on a variable having a certain value, you should verify it is still correct. Sometimes this is a desirable behavior, however.

  2. It is possible to build up many pending actions using this command. If given long wait periods, particularly on triggers which execute quite often sometimes, Nexus will reserve resources for each script that is still running (even if it's just sitting around waiting for something) and this can eventually lead to problems. Your computer may begin to run slowly, or you may run out of memory (unlikely). Either way, a very large backup of scripts that are waiting has the potential for problems with unpredictable results.

Example

#wait 1000                           // Wait for 1 second before continuing.