Skip to content

Room checks

Room checks are an internal mechanism for preventing a character from entering or leaving a room when certain conditions hold.

The important inversion is: when a room check’s condition is true, movement is denied. Write the condition as the reason the movement should be blocked.

Field Meaning
prevent The action to prevent. entry checks the destination room before allowing an actor to enter it. exit checks the current room before allowing an actor to leave it.
direction Applies only to an exit check. When defined, only movement through this exit is blocked.
conditions The expression that prevents movement when it evaluates to true. See Conditions.
failure_msg The message displayed when the condition is true and movement is prevented.

Allow only members of the Mountaineers clan to enter

Section titled “Allow only members of the Mountaineers clan to enter”
prevent: entry
condition: not standing mountaineer 100
failure_msg: Entry is reserved to members of the Mountaineers.

Block the east exit while a soldier is present

Section titled “Block the east exit while a soldier is present”

This check looks for a mob spawned from mob template 1:

prevent: exit
condition: mob_in_room 1
direction: east
failure_msg: A soldier blocks the way east.

The item from template 1 might be a cloak or bandana:

prevent: entry
condition: not item_in_eq 1
failure_msg: You are not welcome here.
prevent: exit
condition: not health 100
failure_msg: You cannot leave until you are fully rested.

Adding direction: east would restrict only the east exit, allowing a west connection to lead to another part of the recovery area.

This example requires the player to carry an item from template 1:

prevent: entry
condition: not item_in_inv 1 1

For a torch, it may make sense for every room in the dark section to prevent entry, and for rooms along the edge of the dark zone to prevent exit unless the player carries the torch. Otherwise, the player could drop the torch in the last dark room, leave, and become unable to enter again—unless there is an established way to obtain another torch outside the area.

For a key, requiring the same key in every room is usually unnecessary. A player might drop a key in a room that requires it for re-entry, but builders do not need to prevent every avoidable mistake.

Fleeing counts as movement, so room checks apply to it. The game evaluates checks before selecting the flee destination. If a room has three exits and checks prevent two, the character should always flee through the available exit. If the only exit is unavailable, fleeing is not an option.