This page was written for DMDirc version 0.6.
The contents may not be applicable to earlier or later versions.
Condition trees allow you to control the way in which action conditions are checked once an action has been triggered. You may specify that some specific conditions must be succeed, some must fail, or a combination of the two. Condition trees are specified in the Action Editor Dialog, which also allows you to select between two default condition trees — one which requires every condition to succeed, and one that only requires that one (or more) succeeds.
Condition trees consist of several parts:
There are three operators:
!) negates the following identifier or bracket, e.g. !3 will evaluate to true if condition 3 evaluates to false&) returns true if both of its operands evaluate to true, e.g. 3&4 will be true if both condition 3 and 4 are true|) returns true if either of its operands is true, e.g. 3|4 will return true if condition 3 is true, condition 4 is true, or both are true.
If there are no brackets to indicate otherwise, DMDirc reads conditions from left to right. When writing condition trees, DMDirc always adds brackets around and and or operations to avoid ambiguity. Whitespace is ignored when reading in trees, and is never output. For example, 3 | 4 & 5 will be treated (and outputted) as ((3|4)&5).
The following examples describe an action designed to kick people from a channel for saying certain words. The response and triggers are not relevant to the condition tree and are omitted for brevity.
(0&(1|2))(0&!(1&2))(0|1)&!(0&1)
Condition trees only allow the three operators described above (and, or and not), but these can be combined to have the same effect as any other boolean operator. This section lists these operators and their equivalent using only and, or and not operators. The examples use 0 and 1 for the operands, substitute your condition numbers as appropriate.
| Operator | Description | Equivalent | |
|---|---|---|---|
XOR | Exclusive or | Exactly one operand must be true | ((0|1)&!(0&1)) |
NOR | Not or | Both operands must be false | (!0&!1) |
NAND | Not and | Either one or neither of the operands can be true, but not both. | !(0&1) |
XNOR | Exclusive not or | Both or neither of the operands must be true | ((!0|1)&(0|!1)) |
| — | Implication | If the left operand is true then the right must be | (!0|1) |