Statements
Rule
The aim of Gate is to define rules, which will be evaluated by Hexagate. Each rule is defined in Gate like so:
rule {
description: "Human-readable description of this rule",
condition: 1 + 1 == 2
};In Gate, rule is one of the few statements you can write. a statement usually defines something, and always ends in a semicolon.
The condition can be any valid boolean source expression (more about source expressions in Source Expressions)
You can add a custom severity to each rule, which will override the default severity of the monitor for events generated by this rule.
rule {
description: "Human-readable description of this rule",
condition: 1 + 1 == 2,
severity: "MEDIUM"
};The severity can be any valid string source expression, but must evaluate to one of "INFO", "LOW", "MEDIUM", "HIGH" or "CRITICAL".
Source
In theory, you could write all rules like the one above. But of course, you can imagine expressions can get pretty long if your rule is complex. You can split your expression into named sources.
Note that in this example, five is the source name, and it is of type integer. Every source is typed, and the full reference for types can be found in Types.
Use
The use statement can provide external data sources implemented by Hexagate.
Struct
The struct statements let you define your own data-type, which can help you organize your data
Param
Let's say I have a lot of enemies. I could re-use this code, and just plug the enemy address when I compile this code. This can be achieved with the param statement.
Now, we could create different monitors from this Gate file, providing a different address for each one.
More about this in the Compilation and Testing section.
Last updated