Difference between revisions of "Virindi Tank Monster List Matching"
(→Variables) |
(→Operators) |
||
Line 40: | Line 40: | ||
* ( and ) allow grouping of expressions to change precedence. | * ( and ) allow grouping of expressions to change precedence. | ||
− | * % performs integer modulo division. For instance, 13%3 yields 1. | + | * % performs integer [http://en.wikipedia.org/wiki/Modulo_operation modulo division]. For instance, 13%3 yields 1. |
* / performs division. | * / performs division. | ||
* * performs multiplication. | * * performs multiplication. |
Latest revision as of 13:26, 31 December 2014
Contents
Introduction
As of 0.3.1.90, Virindi Tank supports expressions in the monster list. This feature allows you to do tests on variables to see if a certain monster list entry is used at a particular time. For instance, you could make one entry active when monsters are at long range and another when they are next to you.
When looking for an entry in the monster list to figure out how to handle a monster, Virindi Tank will start at the top (after DEFAULT) and proceed downwards in the list. The first entry that evaluates to true, or to the monster's name, will be used. If no matches are found, DEFAULT is used.
As an example, consider the following:
In this profile, all blood shreths will be streaked. All other monsters will be yielded and not attacked when they are further away than a distance of 5, and attacked otherwise.
Examples
- range>5 (matches any monster further than 5 yards from you)
- range>5 && species==drudge (matches any monster further than 5 yards from you that also has a species name drudge)
- range>5 && species==drudge (matches any monster further than 5 yards from you that also has a species name drudge)
- range>5 && species==drudge && name!=drudge ravener (matches any monster further than 5 yards from you that also has a species name drudge, except drudge raveners)
Variables
Each expression you place in the monsters list consists of a number of variable names (such as range) and operators (such as > or +). If a variable name is not recognized, it is treated as a text string.
Some variables do not change from monster to monster, such as maximum health or monster name. Others change continuously, such as current range to target. Continuously changing variables are known as 'dynamic'. Since they must be evaluated every tick, you may notice a performance drop if you add hundreds of rules with dynamic variables. Unchanging variables do not have this performance penalty.
The following variables are currently available (you can see this list by typing /vt listmonstervariables):
- true (always evaluates to true)
- false (always evaluates to false)
- name (the monster's name)
- typeid (the number that appears as 'Type' when a monster is propertydumped) TypeID Examples
- species (the name of the monster's species, such as 'Drudge')
- maxhp (the maximum number of hit points this monster has when it first spawns)
- range (DYNAMIC; the range in yards to this target)
- hasshield (DYNAMIC; true if the target has equipped anything of objectclass armor, false otherwise)
- setting_x (DYNAMIC; this allows you to get the value of a macro setting. For instance, 'setting_DoJiggle' will yield a boolean value equivalent to the current DoJiggle setting. This is case-sensitive.)
- metastate (DYNAMIC; returns the string value for the current meta state)
Operators
The following operators are recognized (listed in order of precedence):
- ( and ) allow grouping of expressions to change precedence.
- % performs integer modulo division. For instance, 13%3 yields 1.
- / performs division.
- * performs multiplication.
- + performs addition on numbers, or concatinates two strings.
- - performs subtraction.
- # performs a regex match, yielding true if the match succeeded or false otherwise. The item after the # is the regex and the one before it is the string to match against. For instance, abc#b returns true, because 'abc' contains b.
- !=, ==, >, <, >=, <= comparison operators: compares two expressions and yields true or false. The two expressions to be compared must be of the same type. String comparisons are not case sensitive.
- && yields true if two boolean expressions are both true.
- || yields true if either of two boolean expressions are true.
- \ escapes a special character so that it is treated as part of a string. For instance, ".\*" yields the string ".*" rather than attempting to multiply.