Monster rules and match expressions
A monster rule tells RynthAi how to fight the monsters it covers. A match expression narrows a rule further, for example to monsters close to you or to one meta state.
What a monster rule is
A monster rule is a set of fight settings for some monsters. A rule covers every monster whose name contains the rule's name. A rule named Olthoi covers every monster with "Olthoi" in its name, whether you have met it or not.
The Default rule is the catch-all. Any monster that no other rule covers uses Default.
Where rules are edited
- Damage panel
- The RynthAi dashboard's Monsters button, or
/rc ui open Damage. It lists the monsters you have met, the DEFAULT line, and the Name rules. - Monster Detail
- Click a monster's name in the Damage panel, or a rule's name in Name rules. Or type
/rc ui open Monster Detail.
Click the DEFAULT line's name to edit the Default rule.
What a rule can set
These are in the rule section of Monster Detail:
| Setting | What it does |
|---|---|
| Priority | While a monster of higher priority is in range, it is attacked first, always. 1 is normal. 0 means never attacked or tracked, even if it attacks you. |
| Damage | The element for spells and weapons against it. Auto picks the one it is weakest to. |
| Extra vuln | A vulnerability spell of another element, on top of Vuln. |
| Power | Melee and missile attack power: Default, High, Reckless, Variable, or Reckless + Variable. |
| Kite | Default, Off, or PullAway: tag it, run until it has been pulled a set distance, then kill it. The distance is in Settings > Combat > Pull Away (Kite). |
| Prefer | The kind of damage to fight it with, for a character who uses more than one: Auto, Melee, Missile, War Magic or Void Magic. |
| Match | The match expression. See below. |
| Shapes | Which war or void spell shapes to cast: Arc, Bolt, Ring, Streak, Blast, Wall. |
A rule also holds debuffs (Imperil, Vuln, Fester, Yield, Broadside, Gravity, and the Void curses), the off hand, the pet's element and a weapon. For a monster you have met, set those in its row in the Damage panel. For a name rule, they are in Monster Detail too, with Off hand, Pet, Name and Delete rule.
The Default rule has no Prefer or Match. Its Prefer choice is the Prefer chip in the Damage panel's top bar.
Add a name rule
- Open the Damage panel and click Name rules to unfold it.
- In the first box, type part of a name, such as Olthoi. Or select a monster and click Target to fill in its name.
- If you want, type a match expression in the second box.
- Click Add, or press Enter.
- The new rule starts as a copy of Default. Click its name to set it up in Monster Detail.
To delete a name rule, click its x, then click again to confirm.
How a monster finds its rule
RynthAi goes down the rule list, top to bottom. The first rule that matches is used. If none match, the monster uses Default.
A rule matches when both of these are true:
- The monster's name contains the rule's name. Case doesn't matter.
- The rule has no match expression, or its expression is true for this monster.
A monster's own settings, made from its row in the Damage panel, sit near the top of the list. A name rule you add goes at the end. So a monster's own settings win over a name rule.
Rules imported from a VTank profile keep their match expressions. An imported rule with no name is decided by its expression alone.
Match expressions
A match expression is a short test, such as range < 10. The rule is used only while the test is true. Type it in the Match box in Monster Detail and press Enter to save. Leave it empty to match by name only.
Variables
| Variable | What it holds |
|---|---|
name | The monster's name, as the game shows it. |
range | How far the monster is from you, in metres. A very large number when the distance can't be read. |
typeid | The game's creature type number, such as 3 for Drudge. It is 0 until the game has identified the monster. |
metastate | The name of the state your meta is in now. Default when there is none. |
true | Always true (1). |
false | Always false (0). |
maxhp | Not working in this release. It doesn't read the monster's health, so it comes out 0. |
species | Not working in this release. It doesn't read the creature type. Use typeid. |
hasshield | Not working in this release. It is always false (0). |
Some creature type numbers for typeid:
| Number | Type | Number | Type |
|---|---|---|---|
| 1 | Olthoi | 8 | Tusker |
| 2 | Banderling | 13 | Golem |
| 3 | Drudge | 14 | Undead |
| 4 | Mosswart | 19 | Virindi |
| 5 | Lugian | 26 | Sclavus |
| 6 | Tumerok | 30 | Skeleton |
| 7 | Mite | 31 | Human |
Operators
From loosest to tightest. Tighter ones are worked out first.
| Operator | Meaning |
|---|---|
|| | Or: true when either side is true. |
&& | And: true when both sides are true. |
== != | Equal, not equal. |
< > <= >= | Less than, greater than, at most, at least. |
# | Matches a pattern: true when the left side contains a match for the regular expression on the right. Case doesn't matter. |
+ - | Add, subtract. + on text joins the two. |
* / % | Multiply, divide, remainder. Numbers only. Dividing by 0 gives 0. |
( ) | Brackets: work this part out first. |
&& is tighter than ||. So a || b && c means a || (b && c). Use brackets when you mix them.
How to write them
- Numbers or text. If both sides are numbers, they are compared as numbers. If not, they are compared as text.
- Case. Text comparisons ignore case:
name == "drudge ravener"matches Drudge Ravener. Variable names can be in any case too. - Quotes. Put text in double quotes
"..."or single quotes'...'. You must quote anything with a space, a bracket or a symbol, and every#pattern. A single word can go without quotes. Use double quotes for a name with an apostrophe. - Spaces round minus. Write
range - 5, notrange-5. Without spaces it is read as one word. - Double symbols. And is
&&, or is||. Words likeandandordon't work, and there is no "not" operator. Use!=.
When an expression is wrong
RynthAi does not show an error for a bad expression. Instead:
- An expression that breaks counts as false, so the rule doesn't match.
- A
#pattern that isn't a valid regular expression counts as false. - A misspelt variable, such as
rnage, is read as plain text. The rule then quietly matches never, or always. - Leftover text the reader can't use is ignored.
name == Drudge Ravenerwithout quotes only compares with "Drudge".
After you write an expression, check that the rule is used. Watch which monsters RynthAi picks and how it fights them.
Worked examples
Each example gives the rule's name and its Match box.
| Rule name | Match | What it does |
|---|---|---|
| Drudge | range < 10 | Drudges within 10 m of you. |
| Drudge | name != "Drudge Slinker" | Every drudge except Drudge Slinkers. |
| Golem | typeid == 13 | Only real golems, not other monsters with "Golem" in the name. |
| Olthoi | name # "^Olthoi (Soldier|Warrior)$" | Exactly Olthoi Soldier or Olthoi Warrior. |
| Skeleton | metastate == Boss | Skeletons, but only while your meta is in the state Boss. |
| Lugian | metastate != "Travel" && range <= 25 | Lugians within 25 m, except while your meta is in Travel. |
| Mosswart | (range < 5 || metastate == Melee) && typeid == 4 | Mosswarts that are very close, or any mosswart while the meta is in Melee. |
| Tusker | range - 5 > 20 | Tuskers more than 25 m away. It shows the spaces round minus. |
A common use: fight close drudges first. Make a rule named Drudge with this Match and Priority 2. Drudges farther away don't match it, so they go on down the list, and to Default if nothing else matches.
range < 10
Rule names are unique
Two name rules can't share a name. If you add a rule whose name is already there, it only sets that rule's expression.
Tips
- Keep the rule's name as short as covers the monsters you mean. The expression then narrows it.
- For a whole kind of creature,
typeidis safer than a name: it ignores names that only look alike. - RynthAi checks a monster's priority about once a second, so a rule based on
rangetakes a moment to switch. - Default spell shapes for every monster are also in Settings > Spell Combat.
Known limits
maxhp,speciesandhasshielddon't give useful values in this release.- There is no error message for a bad expression. It just doesn't match.
- The Default rule can't have a match expression.
Commands
| Command | What it does |
|---|---|
/rc ui open Damage | Opens the Damage panel. |
/rc ui open Monster Detail | Opens Monster Detail. |
/ra offhand shield Olthoi | Sets a rule's off hand (auto, shield, weapon or none), then the rule's name. Without a rule name it sets the off hand for everything. |
/ra debuffall | Debuff every monster in range, each with its own rule's debuffs, before attacking any. Add on or off. |
See all commands on the Commands page, or search Find a Feature for "monsters".