ifcommand is the main method of doing conditions in narrat. It can be used to branch inside a script, or to make choice options conditionally available.
"This code is run on condition success"
"This code is run on condition failure"
The condition should be a boolean. You can directly pass a value (
if $data.someValue), or an expression that returns a boolean (for example
if (> $data.player.age 18)
talk player idle "Wow, I found the key!"
add_item key 1
if (has_item? key):
"You open the door and get inside"
"You need a key to open the door!"
talk alice idle "Do you prefer pizza or buger?"
set data.player.prefers "pizza"
set data.player.prefers "burger"
if (== $data.player.prefers "pizza"):
talk alice idle "Let's have pizza then"
talk alice idle "Let's go for a burger"