Skip to content

Commit d93c86d

Browse files
authored
Add a section on using booleans in the scripting language (#44)
* Add a section on using booleans in the scripting language * Removing statement on SetBlackboard limitations
1 parent 3ee9fec commit d93c86d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/guides/scripting.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,36 @@ Example:
128128
val_B = (val_A > 1) ? 42 : 24
129129
```
130130

131+
## Boolean Values
132+
Boolean values can be one of `true` or `false`
133+
and are saved to the blackboard as `1` and `0` respectively.
134+
135+
Setting booleans:
136+
```
137+
val_A = true
138+
val_B := !false
139+
```
140+
The logical `!` works with boolean literals.
141+
`!false` is the equivalent of `true`.
142+
`val_A` and `val_B` above are equivalent.
143+
144+
Using booleans:
145+
```
146+
<Precondition if="val_A" else="FAILURE">
147+
<Precondition if="val_A == true" else="FAILURE">
148+
<Precondition if="val_A == 1" else="FAILURE">
149+
```
150+
All of the scripts used in precondition nodes above are valid.
151+
152+
When evaluating the boolean value, it can be:
153+
- checked directly,
154+
- compared with the literals `true` and `false`
155+
- compared with `1` and `0`.
156+
157+
158+
Note that capitalization of the words "true" and "false" in any manner will not work.
159+
160+
131161
## C++ example
132162

133163
Demonstration of the scripting language, including how to use enums to

0 commit comments

Comments
 (0)