Actions

Difference between revisions of "Aliases"

From Iron Realms Nexus Client Documentation

Line 97: Line 97:
  
 
[[File:action-wait.png]]
 
[[File:action-wait.png]]
 +
 +
 +
===== Modify variable =====
 +
The modify variable action is used to modify a certain variable - you can assign a fixed value to it, modify (increase / decrease / ...) it by some value, assign the value of another variable to it, or modify it by the value of another variable.
 +
 +
 +
===== If =====
 +
This action allows you to branch the execution of your script based on what is going on - you can specify a condition to check, and actions to perform if the condition is, or is not, true. You can compare two variables, or a variable and a fixed value. When the check succeeds or fails, you can choose whether the script should continue running normally, stop, or continue running from a Label action.
 +
 +
 +
===== Repeat =====
 +
This action allows you to repeat a block of actions multiple times. All actions up to a label that you specify will be repeated.
 +
 +
 +
===== Disable this reflex =====
 +
This simple action disables the current reflex.
 +
 +
 +
===== Disable reflex =====
 +
This action disables a reflex of your choice. The reflex must have a name.
 +
 +
 +
===== Enable reflex =====
 +
This action enables a reflex of your choice. The reflex must have a name.
 +
 +
 +
===== Label =====
 +
This action does nothing at all. It is used together with the If, Repeat, and Goto actions to do conditional execution and looping.
 +
 +
 +
===== Goto =====
 +
This action causes a jump to the label of your choice. It is best used inside an If or Repeat block, so you don't create an endless loop (the client does offer protection against these).
 +
 +
 +
===== Wait for =====
 +
This action is essentially a temporary trigger. It allows you to specify a line or pattern to wait for. Once encountered, the script will continue executing normally. If not encountered within the specified timeout, the script is aborted.
  
  

Revision as of 19:52, 26 January 2016

How to Create a New Alias

Aliases are shortcuts you can create for more complicated commands in the game. Aliases are commonly used for combat. For example I may create an alias that will send the command 'consecrate ground with holysymbol' by just typing in 'cg'.

On this page we will demonstrate how to create a new alias.

Step 1. Open the settings page and click the 'Reflexes' tab.

Reflexes is a term for all of the settings used to automate the game experience. In order to create a new alias you must first click on the 'Reflexes' tab as shown in the image below.

Tab-reflexes.png

Step 2. Click the 'Add' Button and select 'Add an Alias'.

There are several different reflexes you can create. We want to create an alias. In order to do this, click the 'Add' button located in the left pane and then click on 'Add an Alias'. This will create a new, undefined alias.

Alias-create.png

Step 3. Options for Aliases.

There are two parts to an alias; Matching and Actions.

Matching is based on what you type into the game. Usually this is a shorter version of a longer command. For example I may use 'arl' for 'apply restoration to legs'.

Actions are what happens when the command is entered into the game. In the example above, 'apply restoration to legs' would be sent to the game when you type in 'arl'.

Alias-options.png


Matching Options

Matching is used for creating the command for the alias you are creating. There are five settings.

Alias-matching.png

Alias Text

This field is required and contains the alias text. Anything can be used to create your alias. Typically they are very short and easy to remember. for example I may use the text 'sh' and later create an action that will do 'say hello world!'.

This works hand in hand with the 'Matching Type' option. See below.

Whole Words Only

If checked, the alias will only match whole words.

For example, my alias text is 'sh'

In this case, if I type in 'sha' it will NOT match. However, 'sh a' WILL work.

If I uncheck 'Whole words only', then 'sha' will work.

In almost all cases you will just want to keep 'Whole words only' checked. Remember that whole words are separated by spaces and punctuation is considered part of a word.

Case Sensitive

If checked, capitalization must match.

For example, if checked, 'sh' is not the same as 'SH'.

Alias Name

(Optional) The name of the alias. The name is an identifier that will show up in your list of reflexes. It is not required for your alias and has nothing to do with the actual operation of the alias.

Matching Type

There are three options for matching text.

  • Begins with: Will only match a command that starts with your alias text in it.
  • Exact match: Will only match an alias that exactly matches your alias text.
  • Regular expression: This will match any 'regular expression' patterns. This is somewhat advanced, but good to learn. See the examples below.

In most cases you will want to use 'Begins with'.

Action Options

Once you have matched a command, you will want to send an action back.

Trigger-actions.png


There are eight different action options, and a few built-in variables called Expansions (see below) to help you out.

Send a command

This is the most basic and commonly used action. The alias will send the text to the game.

Action-send.png


Show a notice

The action will display text using the set colors. It does not actually send any commands to the game.

Action-notice.png


Wait

The wait action is usually used in conjunction with other actions. In the example below, we wait 3 seconds and then attack the rat.

Action-wait.png


Modify variable

The modify variable action is used to modify a certain variable - you can assign a fixed value to it, modify (increase / decrease / ...) it by some value, assign the value of another variable to it, or modify it by the value of another variable.


If

This action allows you to branch the execution of your script based on what is going on - you can specify a condition to check, and actions to perform if the condition is, or is not, true. You can compare two variables, or a variable and a fixed value. When the check succeeds or fails, you can choose whether the script should continue running normally, stop, or continue running from a Label action.


Repeat

This action allows you to repeat a block of actions multiple times. All actions up to a label that you specify will be repeated.


Disable this reflex

This simple action disables the current reflex.


Disable reflex

This action disables a reflex of your choice. The reflex must have a name.


Enable reflex

This action enables a reflex of your choice. The reflex must have a name.


Label

This action does nothing at all. It is used together with the If, Repeat, and Goto actions to do conditional execution and looping.


Goto

This action causes a jump to the label of your choice. It is best used inside an If or Repeat block, so you don't create an endless loop (the client does offer protection against these).


Wait for

This action is essentially a temporary trigger. It allows you to specify a line or pattern to wait for. Once encountered, the script will continue executing normally. If not encountered within the specified timeout, the script is aborted.


Call function

Functions are created with javascript and then called when the alias is typed into the game. You can read more about functions here: Functions.

Action-function.png


Execute Script

Scripts are just like functions, but you write them in the box provided. You can read more about writing scripts and functions here: Functions.

Action-script.png


Expansions

Aliases support expansions, which allow you to add on-the-spot modifications to the command you send to the game.

For example, let's say you want to make an alias that picks up an item and puts it into your pack, called pp. To do this, you can simply make an alias with pp as the alias text, and two actions (use Add Action to add the second one), get @suffix and put @suffix in pack. The 'suffix' in this case is anything that comes after the alias in your command.

For both actions, disable the include prefix and suffix option, and you are done. See Put Pack Alias.

The available expansions are:

  • @match - the matched text
  • @suffix - anything coming after the matched text
  • @prefix - anything coming in front of the matched text; this only makes sense for regular expressions

Tip: You can use @line to send the original command along with the aliased commands - this is useful if you want to perform additional actions when sending a particular command, instead of replacing it.

Here is more information about expansions.

Examples