Actions

Triggers: Difference between revisions

From Iron Realms Nexus Client Documentation

 
(51 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Triggers are used to automatically send commands to the game when certain lines of text are received from the game.  
Triggers are a very powerful and versatile type of reflexes. Triggers allow you to automatically react when text (and other events) is sent to your character from the game.  


A few brief examples of things triggers can do:


== How to Create a New Trigger ==
* Automatically send commands to the game when certain text is received.
* Hide unimportant lines you don't want to see.
* Highlight lines of text you do not want to accidentally miss.
* Modify portions of the lines received from the game.
* Save data in a variable for later use. Such as how much gold you picked up or the name of a player that hit you.


Triggers are settings created by you to automatically send commands back to the game when you receive specific text from the game. For example, you may want to automatically attack a rat whenever you see one enter the room you are in.  
The basic usage of triggers is similar to that of [[aliases]] or [[keybinds]]. One thing to be careful of is that by default, triggers can match anywhere in the received text, not only at the beginning (you can change the ''Matching Type'' accordingly, if desired).


On this page we will demonstrate how to create a new trigger and explain the various settings.
== How to Create a New Trigger ==


You can then follow some of the example links at the bottom of the page to help get a better understanding.
Triggers are a reflex. They are created and managed from the Reflexes tab in the settings window. To open the settings window, click on the gear icon [[File:Settings_icon.jpg|text-bottom]] in the lower right part of your main game screen


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


Reflexes is a term for settings you used to help automate your game experience. In order to create a new trigger you must first click on the 'Reflexes' tab.
To create a new trigger, open your settings window by clicking on the gear icon [[File:Settings_icon.jpg|text-bottom]] in the lower right part of your game screen. This will popup a new window in your browser.  


[[File:tab-reflexes.png]]
In the settings window, click on the 'Reflexes' tab as shown in the image below.


[[File:tab-reflexes.png|frame|center|Setting window displaying the reflexes tab.]]


=== Step 2. Click the 'Add' Button and select 'Add a Trigger'. ===
=== Step 2. Click the 'Add' Button and select 'Add a Trigger'. ===


There are several different types of reflexes. In this case we want to create a new trigger. In order to do this, click on the 'Add' button and then click on 'Add a Trigger'.
There are several different reflexes you can create. We want to create a trigger. In order to do this, click the 'Add' button located in the left pane and then click on 'Add a Trigger'. This will create a new, undefined trigger.
 
Should you want to delete a trigger, you can select the trigger from the list, and then click the 'Remove' button.


[[File:Trigger-create.png]]
[[File:Trigger-create.png|frame|center|Example of creating a new trigger.]]


=== Step 3: Triggers Options. ===


=== Step 3. Options for Triggers. ===
There are two main option sections for triggers; '''Matching''' and '''Actions'''.


There are two main parts of a trigger. Matching and Actions.
'''Enabled''' This checkbox marks if the trigger is currently being used by the system. If unchecked, this trigger will not be used.


Matching is used to figure out what text you would like to respond to.
'''Matching''' is used to find the text you would like to use for this trigger. When the game sends text to your character that matches, it will automatically send the action defined below it.


Actions are used tell the game what you want to happen when that text is matched.
'''Actions''' is what will happen when the trigger matches text from the game. Actions can be used to automatically send text to the game, highlight you want to stand out, create complicated functions, and other things.


[[File:trigger-blank.png]]
[[File:trigger-blank.png|frame|center|This is a blank trigger. It will not do anything until you add text to match and an action to do when that text is matched.]]


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


The matching part of a trigger is used to tell them game what text you want to react to.
Matching is used to find text sent from the game to create an action for. You can match entire lines of text, single words, partial lines, and lines of text with variable words.


[[File:trigger-matching.png]]
[[File:trigger-matching.png]]
Line 42: Line 51:
There are five options for matching text.
There are five options for matching text.


===== Trigger Text =====
=== Trigger Text ===


In this field you put the text you want to match.
This field is required and contains the text to match.  
   
   
Examples:
Examples of Trigger Text:
* You have recovered balance.
* You have recovered balance.
* You have recovered
* You have recovered
Line 52: Line 61:
* You have recovered balance.
* You have recovered balance.


This works hand in hand with the 'Matching Type' option.  
This works hand in hand with the '''Matching Type''' option. See below.
 
==== Wildcards in Trigger Text  ====


You can match much more complicated text then just text. You can set up triggers to look for text that may not always be the same using regular expressions. This is more complicated and you can check the examples at the bottom of the page for how to do this.
This is a very powerful feature in the Nexus client that you will want to understand.


===== Trigger Name =====
There are times when you'll want to use wildcard matches in your triggers. Most messages you will want to trigger will vary slightly. Character names, item number, and more.


(Optional) The name of the trigger. The name is an identifier that will show up in your list of triggers. It is not required for your trigger and has nothing to do with the actual operation of the trigger.
For example, let's say someone is entering the room you are in.


===== Matching Type =====
You can the name in <>'s to allow the trigger to fire. You can also assign the name to a variable. If an example line is ''Jeremy enters from the north'', you could configure your trigger to match on ''<person> enters from the <direction>''. As an added bonus, you can then use @person and @direction as variables in the trigger actions.


There are four options.
These simplified triggers do not work with regular expressions, and if using this advanced feature, you'll want to ensure that you're using the correct syntax.


* Contains: This will match any line that has your trigger text in it.
[[WildcardMatching|Here is a full example of a basic wildcard match.]]
* Begins with: Will only match a line that starts with your trigger text in it.
* Exact match: Will only match a line that matches exactly like your trigger text.
* Regular expression: This will match any regular expression patterns. This is advanced, but good to learn.  


===== Whole Words Only =====  
=== Matching Type ===


If this box is checked, the trigger will only check whole words. For example:
There are four options for matching text.


With 'Whole words only' checked and Trigger Text set to 'You have recovered bal'.
* '''Contains''': This will match any line that has your trigger text in it.
* '''Begins with''': Will only match a line that starts with your trigger text in it.
* '''Exact match''': Will only match a line that matches exactly like your trigger text.
* '''Regular expression''': This will match any regular expression patterns. This is advanced, but good to learn.  


In this case, if the game sends the text - You have recovered balance. - it will not match, because 'balance.' is a different whole word than 'bal'.
In most cases you will want to use ''Contains'' option unless you have more complicated situations.


If I uncheck 'Whole words only', then the trigger would work.
=== Whole Words Only ===


In almost all cases you will just want to keep 'Whole words only' turned on.
If checked, the trigger will only match whole words.  


===== Case Sensitive =====
For example; you create a trigger with trigger text set to 'You have recovered bal'.


If checked, the capitalization from the game must match what is in the trigger.  
If the game sends the text - You have recovered balance. - it will '''NOT''' match, because 'balance.' is a different whole word than 'bal'.


For example, if this box is checked then 'You have recovered balance' is not the same as 'You HAVE reCOvered balance'.  
If I uncheck 'Whole words only', the trigger would work.  


However, if you uncheck the this option, the example above will work.
In almost all cases you will just want to keep 'Whole words only' turned on and be sure to include the full trigger text. Remember that whole words are separated by spaces and punctuation is considered part of a word.


==== Action Options ====
=== Match Case ===  


Once you have matched text from the game, you will want to send an action back.  
If checked, capitalization must match.  


[[File:trigger-actions.png]]
For example, if checked, 'You have recovered balance' is not the same as 'You HAVE reCOvered balance'.  


You have eight different possible actions.
If unchecked, the example above will work.
===== Send a command =====
This is the most basic and commonly used action. The trigger will automatically send text back to the game.
[[File:action-send.png]]


===== Show a notice =====
=== Trigger Name ===
The action will just display a notice using whatever colors you choose. Typically players use these to get something to pop out at them so they know it has happened, but they may not want to automatically respond.
[[File:action-notice.png]]


===== Wait =====
(Optional) The name of the trigger. The name is an identifier that will show up in your list of triggers. It is used for organizing your triggers. It is not required for your trigger and has nothing to do with the actual operation of the trigger.
The wait action is usually used in conjunction with other actions. In the example below, we wait 3 seconds and then attack the rat.
[[File:action-wait.png]]


===== Hide the line =====
== Action Options Explained ==
You can also opt to just hide any line that matches you trigger. Sometimes this is good for text that you see over and over again and are tired of reading.


This is also refereed to as a gag or gagging.
Once you have matched text from the game, you can initiate a single action, or a series of multiple actions. Actions will fire in the order they are listed.
[[File:action-hide.png]]


===== Highlight =====
[[File:trigger-actions.png]]
This will highlight the text you have matched. There are more options here to highlight the text around the trigger as well.
[[File:action-highlight.png]]


===== Rewrite =====
Above is a simple example of three separate actions that will happen when a trigger fires.
A rewrite will change the trigger text into whatever your would like. Players will typically use this to shorten long messages in combat.
[[File:action-rewrite.png]]


===== Call function =====
=== Simplified Scripting ===
Functions are used when you may be doing something more complicated and would like to use some javascript to make it happen. You can read more about functions here: [[Functions]].
[[File:action-function.png]]


===== Execute Script =====
The Nexus client allows for fifteen different [[SimplifiedScripting|simplified scripting]] actions. 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.
Scripts are just like functions, but you write them in the box provided. You can read more about writing scripts and functions here: [[Functions]].
[[File:action-script.png]]


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


=== Advanced Scripting ===


[[Balance Recovery Attack]]: This is an example of a trigger to automatically attack a target when you recover balance.
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.


== Examples ==
You can view some example triggers on the [[examples]] page.


== Regular Expression Help ==
== Regular Expression Help ==
* http://www.regular-expressions.info/
* http://www.regular-expressions.info/

Latest revision as of 18:11, 15 September 2016

Triggers are a very powerful and versatile type of reflexes. Triggers allow you to automatically react when text (and other events) is sent to your character from the game.

A few brief examples of things triggers can do:

  • Automatically send commands to the game when certain text is received.
  • Hide unimportant lines you don't want to see.
  • Highlight lines of text you do not want to accidentally miss.
  • Modify portions of the lines received from the game.
  • Save data in a variable for later use. Such as how much gold you picked up or the name of a player that hit you.

The basic usage of triggers is similar to that of aliases or keybinds. One thing to be careful of is that by default, triggers can match anywhere in the received text, not only at the beginning (you can change the Matching Type accordingly, if desired).

How to Create a New Trigger

Triggers are a reflex. They are created and managed from the Reflexes tab in the settings window. To open the settings window, click on the gear icon in the lower right part of your main game screen

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

To create a new trigger, open your settings window by clicking on the gear icon in the lower right part of your game screen. This will popup a new window in your browser.

In the settings window, click on the 'Reflexes' tab as shown in the image below.

Setting window displaying the reflexes tab.

Step 2. Click the 'Add' Button and select 'Add a Trigger'.

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

Should you want to delete a trigger, you can select the trigger from the list, and then click the 'Remove' button.

Example of creating a new trigger.

Step 3: Triggers Options.

There are two main option sections for triggers; Matching and Actions.

Enabled This checkbox marks if the trigger is currently being used by the system. If unchecked, this trigger will not be used.

Matching is used to find the text you would like to use for this trigger. When the game sends text to your character that matches, it will automatically send the action defined below it.

Actions is what will happen when the trigger matches text from the game. Actions can be used to automatically send text to the game, highlight you want to stand out, create complicated functions, and other things.

This is a blank trigger. It will not do anything until you add text to match and an action to do when that text is matched.

Matching Options Explained

Matching is used to find text sent from the game to create an action for. You can match entire lines of text, single words, partial lines, and lines of text with variable words.

There are five options for matching text.

Trigger Text

This field is required and contains the text to match.

Examples of Trigger Text:

  • You have recovered balance.
  • You have recovered
  • recovered balance.
  • You have recovered balance.

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

Wildcards in Trigger Text

This is a very powerful feature in the Nexus client that you will want to understand.

There are times when you'll want to use wildcard matches in your triggers. Most messages you will want to trigger will vary slightly. Character names, item number, and more.

For example, let's say someone is entering the room you are in.

You can the name in <>'s to allow the trigger to fire. You can also assign the name to a variable. If an example line is Jeremy enters from the north, you could configure your trigger to match on <person> enters from the <direction>. As an added bonus, you can then use @person and @direction as variables in the trigger actions.

These simplified triggers do not work with regular expressions, and if using this advanced feature, you'll want to ensure that you're using the correct syntax.

Here is a full example of a basic wildcard match.

Matching Type

There are four options for matching text.

  • Contains: This will match any line that has your trigger text in it.
  • Begins with: Will only match a line that starts with your trigger text in it.
  • Exact match: Will only match a line that matches exactly like your trigger text.
  • Regular expression: This will match any regular expression patterns. This is advanced, but good to learn.

In most cases you will want to use Contains option unless you have more complicated situations.

Whole Words Only

If checked, the trigger will only match whole words.

For example; you create a trigger with trigger text set to 'You have recovered bal'.

If the game sends the text - You have recovered balance. - it will NOT match, because 'balance.' is a different whole word than 'bal'.

If I uncheck 'Whole words only', the trigger would work.

In almost all cases you will just want to keep 'Whole words only' turned on and be sure to include the full trigger text. Remember that whole words are separated by spaces and punctuation is considered part of a word.

Match Case

If checked, capitalization must match.

For example, if checked, 'You have recovered balance' is not the same as 'You HAVE reCOvered balance'.

If unchecked, the example above will work.

Trigger Name

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

Action Options Explained

Once you have matched text from the game, you can initiate a single action, or a series of multiple actions. Actions will fire in the order they are listed.

Above is a simple example of three separate actions that will happen when a trigger fires.

Simplified Scripting

The Nexus client allows for fifteen different simplified scripting actions. 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.

All of these options, with full explanations and examples can be found here: simplified scripting.

Advanced Scripting

There are two main 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.

Examples

You can view some example triggers on the examples page.

Regular Expression Help