Actions

3.0 Aliases: Difference between revisions

From Iron Realms Nexus Client Documentation

No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:
<div class="row">
<div class="row">
<div class="large-8 columns">
<div class="large-8 columns">
Aliases are simply convenient shortcuts you can make for more complex in-game actions. They are often used during in-game combat to perform actions more quickly. Aliases can also be combined with certain changeable elements (known as [[3.0_variables|variables]]) to make even more versatile shortcuts.
Aliases are simply convenient shortcuts you can make for more complex in-game actions. They are often used during in-game combat to perform actions more quickly. Aliases can also be combined with certain changeable elements (known as [[3.0_Variables|variables]]) to make even more versatile shortcuts.


Here are some examples to illustrate the concept of aliases:
Here are some examples to illustrate the concept of aliases:
Line 47: Line 47:
=== Step 3. Aliases Options. ===
=== Step 3. Aliases Options. ===


There are three main options for aliases; '''Enabled''', '''Matching''' and '''Actions'''.
In the alias creation area, you will find three main sections for setting up your aliases. They are not clearly labeled, but can be identified as "Enabled", "Matching", and "Actions".


'''Enabled''' This checkbox marks if the alias is currently being used by the system. If unchecked, this alias will not be used.
#Enabled: This section has a checkbox that you can toggle on or off. When this checkbox is ticked, it means that the alias is turned on and ready to be used. If it's not ticked, the alias is turned off and the system won't use it.
#Matching: Here, you will assign a command to your alias, which is typically a shorter version of a longer command. For example, you could use 'arl' as an alias for 'apply restoration to legs'. This short command is what you will type into the game to trigger the alias.
#Actions: This section defines the outcome that takes place when the alias command is entered into the game. For instance, if you have set 'arl' as your alias for 'apply restoration to legs', typing 'arl' into the game will execute the full command 'apply restoration to legs'.


'''Matching''' is what command you would like to assign to your alias. 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'.
These three sections work together to create a streamlined experience by allowing you to use shorter commands for actions you perform frequently in the game.


[[File:alias-options.png]]
[[Image:3.0-reflex-tab-alias-arl.png]]


== Matching Options Explained ==
== Understanding Matching Options ==


Matching is used for creating the command for the alias you are creating. There are five settings.
The "Matching" section helps you set up the command for the alias you're creating. It offers five different settings.


[[File:alias-matching.png]]
[[image:3.0-alias-matching.png]]


=== Alias Text ===
=== Match Text That ===


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 option defines how your alias text will be recognized. There are three possibilities:


This works hand in hand with the 'Matching Type' option. See below.
*Begins with: The system will only recognize a command that starts with your alias text.
*Exact match: The system will only recognize an input that is identical to your alias text.
*Matches regex: This advanced option allows the system to match regular expression patterns.


=== Whole Words Only ===


If checked, the alias will only match whole words.  
Typically, the 'Begins with' option is the most useful for most situations.


For example, my alias text is 'sh'
=== Value ===


In this case, if I type in 'sha' it will NOT match. However, 'sh a' WILL work.
This mandatory field is where you input the alias text. You can use anything to create your alias, but it's usually best to keep it short and memorable. For instance, you might use 'sh' and later assign it an action like 'say hello world!'.


If I uncheck 'Whole words only', then 'sha' will work.  
The Alias Text field interacts closely with the 'Matching Type' option, as explained above.


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.
=== Whole Words Only ===


=== Match Case ===
When this checkbox is ticked, the alias will only recognize whole words.


If checked, capitalization must match.
Consider an alias text like 'sh':


For example, if checked, 'sh' is not the same as 'SH'.  
If you type 'sha', it will NOT be recognized as your alias. However, if you type 'sh a', it will be recognized.


=== Alias Name ===
If you uncheck the 'Whole words only' box, then 'sha' would be recognized as the alias.
 
In most cases, it's best to keep 'Whole words only' checked. Note that words are considered whole if they are separated by spaces, and any punctuation is considered part of the word.


(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.
=== Match Case ===


=== Matching Type ===
With this checkbox ticked, the alias will be case-sensitive.


There are three options for matching text.
For instance, if this option is enabled, 'sh' would not be seen as the same as 'SH'.


* Begins with: Will only match a command that starts with your alias text in it.
=== Alias Name ===
* 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'.
(Optional) This is simply a label for your alias. It helps identify the alias in your list of reflexes. It isn't necessary for the operation of the alias and doesn't impact its functionality.


== Action Options Explained ==
== Understanding Action Options ==


Once you have decided on the text for your alias, you can initiate a single action, or a series of multiple actions. Actions will fire in the order they are listed.
After determining the text for your alias, you can associate it with one action or a sequence of multiple actions. Actions will execute in the order they are listed.


[[File:trigger-actions.png]]
[[Image:3.0-alias-commands-01.png]]


Above is a simple example of three separate actions that will happen when an alias is entered into the game.
The image above presents a simple example of three separate actions that occur when an alias command is input into the game.


=== Simplified Scripting ===
=== Simplified Scripting ===


The Nexus client allows for twelve different [[SimplifiedScripting|simplified scripting]] actions for use in aliases. In most cases instantly returning a command is the best option. However, the Nexus client will allow you to loop through commands, use if statements, wait commands, highlight text, and much more.
The Nexus client supports 18 different [[3.0_Simplified_Scripting|simplified scripting]] actions that can be used in aliases. In many cases, an immediate return of a command is ideal. However, the Nexus client also allows you to cycle through commands, use if statements, wait commands, highlight text, and much more.


All of these options, with full explanations and examples can be found here: [[SimplifiedScripting|simplified scripting]].
Detailed explanations and examples of these options can be found here: [[3.0_Simplified_Scripting|simplified scripting]].


Below is an example of a simple alias which opens a door for you if one is in your way, while trying to move south.
Below is a simple alias example that automatically opens a door blocking your path when trying to move south.


[[Image:SouthAlias.png|600px]]
[[Image:3.0-alias-commands-door.png]]


The first action chosen is the basic "send a command", which sends the text "south" to the game. This is just like typing south into the command line.
*The first selected action is "send a command", which sends the text "south" to the game as if you typed it into the command line.  
Next, we have the "wait for" action, which creates a temporary trigger, waiting for the words "There is a door in the way.".  If we get that message, then we send the next action which is, again, "send a command". In this case we send two commands, one to open the door, and another to move south.
*Next, there's the "wait for" action, which sets up a temporary trigger that waits for the phrase "There is a door in the way."  
*When this message appears, we have two more actions, both of which are "send a command".  
*This time, we send the commands: one to open the door, and another to move south.




Another slightly more advanced option, would be if you wanted to override the basic SAY command to rotate between speech patterns.
A more advanced option would be using a TALK alias to use the basic SAY command to alternate between different speech patterns.


[[Image:Say1Alias.png|600px]]
[[Image:3.0-alias-say.png]]
[[Image:Say2Alias.png|600px]]
[[Image:Say3Alias.png|600px]]
[[Image:Say4Alias.png|600px]]


To explain this alias step by step. In the first "talk" alias, we set a local var called "talk_counter" which increments by 1 every time we talk. Based on the value of that var, we choose a different version of talking to send to the client.  (Sloshing around), or (Waving his hands) for example. 
To break down this alias: In the first "talk" alias, we set a local variable named "talk_counter" that increments by 1 every time we talk. Depending on the value of that variable, we choose a different style of talking to send to the client, like *ANGRILY or *HAPPILY. (These are used with the Achaea adverb system) The labels direct the If blocks based on the "talk_counter" value. After reaching the final If result, the script simply continues to the next line without going to a label, setting "talk_counter" back to 0 to restart the loop. Note the use of the "Stop" command to prevent the script from continuing after reaching the end of a specific label.
The labels tell the If blocks, where to go based on the value of "talk_counter". When we reach the final If result, instead of going to a label, the script simple continues to the next line. At this point, we set the value of talk_counter back to 0, so we can start the loop all over again.
Also note, the use to the "Stop" command, to prevent the script from continuing after reaching the end of a specific label.


As you might have surmised, this creates a problem if you try to "SAY TO" somebody.  To fix this, we create a second alias which handles the "SAY TO" input.
Also note that the alias uses "Begins with" in the matching section and "Include prefix and suffix" in the "send a command" actions.


[[Image:SayToAlias.png|600px]]
=== Advanced Scripting ===


In this second alias, we set two local variables, and change the alias to "sayto", so that we can capture the specific case of talking to a person instead of talking in general.
There are two main [[3.0_advanced_scripting|advanced scripting]] options: ''Call function'' and ''Execute script''. Both of these options allow for the use of JavaScript. To learn more, you can find information on [[functions|functions]] here and on [[Javascript]] here.


=== Advanced Scripting ===
Here is an example of the talk project done using a script option instead of the Simplified Scripting example above. As you can tell, it is much more concise.


There are two main [[AdvancedScripting|advanced scripting]] options. You can ''Call function'' or you can ''Execute script''. Both options allow for the use of javascript. You can learn more and [[functions]] here and more about [[javascript]] here.
[[Image:3.0-alias-say-script.png]]


== Expansions ==
== Expansions ==
Line 157: Line 156:
* @suffix - anything coming after 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
* @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.
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.

Latest revision as of 02:20, 23 June 2023

Aliases are simply convenient shortcuts you can make for more complex in-game actions. They are often used during in-game combat to perform actions more quickly. Aliases can also be combined with certain changeable elements (known as variables) to make even more versatile shortcuts.

Here are some examples to illustrate the concept of aliases:

  • Typing "dh" instead of the longer "DRINK HEALTH" command.
  • Using "t jeremy" to designate Jeremy as your in-game target.
  • Creating a safeguard for a command you might accidentally activate, such as "GIVE" or "QUIT".
  • Setting up a shortcut like "cg" to perform the longer command of "consecrate ground with holysymbol".

How to Create a New Alias

Aliases are categorized as a type of reflex. This means they are quick actions performed with ease. To create and manage aliases, you'll need to go to the "Reflexes" settings option, which is located in the settings window.

Here’s how you can access this tab:

  • Look for a gear icon on the main game screen, situated in the lower right corner.
  • Click on this gear icon to open the settings window.
  • Within the settings window, find and click on the "Reflexes" button.
  • Here, you will be able to create new aliases and manage existing ones for more efficient gameplay.

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

Creating a new alias is simple. Begin by accessing the settings window. You can do this by clicking on the gear icon, typically located in the lower right corner of your game screen. When you click on this icon, you will be presented with the settings window.

Select the "Reflexes" button and a new window will appear in your browser, where you'll be able to manage and create aliases as well as many other settings.

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

Within the settings window, you will see options to create different types of reflexes. For our purpose, we want to create an alias.

Here are the steps to create an alias:

  1. Look for the "Add New" button, which is usually located in the left section of the window.
  2. Click on this "Add New" button.
  3. A menu will appear. From this menu, select "Add an Alias".


By doing this, you have created a new alias, but it doesn't have any instructions yet – it's undefined. Next, you'll need to define what this alias should do.

Step 3. Aliases Options.

In the alias creation area, you will find three main sections for setting up your aliases. They are not clearly labeled, but can be identified as "Enabled", "Matching", and "Actions".

  1. Enabled: This section has a checkbox that you can toggle on or off. When this checkbox is ticked, it means that the alias is turned on and ready to be used. If it's not ticked, the alias is turned off and the system won't use it.
  2. Matching: Here, you will assign a command to your alias, which is typically a shorter version of a longer command. For example, you could use 'arl' as an alias for 'apply restoration to legs'. This short command is what you will type into the game to trigger the alias.
  3. Actions: This section defines the outcome that takes place when the alias command is entered into the game. For instance, if you have set 'arl' as your alias for 'apply restoration to legs', typing 'arl' into the game will execute the full command 'apply restoration to legs'.


These three sections work together to create a streamlined experience by allowing you to use shorter commands for actions you perform frequently in the game.

Understanding Matching Options

The "Matching" section helps you set up the command for the alias you're creating. It offers five different settings.

Match Text That

This option defines how your alias text will be recognized. There are three possibilities:

  • Begins with: The system will only recognize a command that starts with your alias text.
  • Exact match: The system will only recognize an input that is identical to your alias text.
  • Matches regex: This advanced option allows the system to match regular expression patterns.


Typically, the 'Begins with' option is the most useful for most situations.

Value

This mandatory field is where you input the alias text. You can use anything to create your alias, but it's usually best to keep it short and memorable. For instance, you might use 'sh' and later assign it an action like 'say hello world!'.

The Alias Text field interacts closely with the 'Matching Type' option, as explained above.

Whole Words Only

When this checkbox is ticked, the alias will only recognize whole words.

Consider an alias text like 'sh':

If you type 'sha', it will NOT be recognized as your alias. However, if you type 'sh a', it will be recognized.

If you uncheck the 'Whole words only' box, then 'sha' would be recognized as the alias.

In most cases, it's best to keep 'Whole words only' checked. Note that words are considered whole if they are separated by spaces, and any punctuation is considered part of the word.

Match Case

With this checkbox ticked, the alias will be case-sensitive.

For instance, if this option is enabled, 'sh' would not be seen as the same as 'SH'.

Alias Name

(Optional) This is simply a label for your alias. It helps identify the alias in your list of reflexes. It isn't necessary for the operation of the alias and doesn't impact its functionality.

Understanding Action Options

After determining the text for your alias, you can associate it with one action or a sequence of multiple actions. Actions will execute in the order they are listed.

The image above presents a simple example of three separate actions that occur when an alias command is input into the game.

Simplified Scripting

The Nexus client supports 18 different simplified scripting actions that can be used in aliases. In many cases, an immediate return of a command is ideal. However, the Nexus client also allows you to cycle through commands, use if statements, wait commands, highlight text, and much more.

Detailed explanations and examples of these options can be found here: simplified scripting.

Below is a simple alias example that automatically opens a door blocking your path when trying to move south.

  • The first selected action is "send a command", which sends the text "south" to the game as if you typed it into the command line.
  • Next, there's the "wait for" action, which sets up a temporary trigger that waits for the phrase "There is a door in the way."
  • When this message appears, we have two more actions, both of which are "send a command".
  • This time, we send the commands: one to open the door, and another to move south.


A more advanced option would be using a TALK alias to use the basic SAY command to alternate between different speech patterns.

To break down this alias: In the first "talk" alias, we set a local variable named "talk_counter" that increments by 1 every time we talk. Depending on the value of that variable, we choose a different style of talking to send to the client, like *ANGRILY or *HAPPILY. (These are used with the Achaea adverb system) The labels direct the If blocks based on the "talk_counter" value. After reaching the final If result, the script simply continues to the next line without going to a label, setting "talk_counter" back to 0 to restart the loop. Note the use of the "Stop" command to prevent the script from continuing after reaching the end of a specific label.

Also note that the alias uses "Begins with" in the matching section and "Include prefix and suffix" in the "send a command" actions.

Advanced Scripting

There are two main advanced scripting options: Call function and Execute script. Both of these options allow for the use of JavaScript. To learn more, you can find information on functions here and on Javascript here.

Here is an example of the talk project done using a script option instead of the Simplified Scripting example above. As you can tell, it is much more concise.

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

Learn how to create more aliases on the examples page.