Expression

Category: Gate Tier: Basic

Purpose

Evaluates custom boolean expressions with complex logic, allowing arbitrary combinations beyond simple AND/OR/XOR gates.

Visual Reference

As added to your scene
Expression brick as it appears in the GDLink editor

When To Use

  • Complex AI decisions with many conditions

  • Multi-step puzzles (if A and B, or if C but not D)

  • Advanced state machines

  • Formula-based logic

  • Replacing chains of controllers with single expression

Runtime Behavior

Triggers: When the boolean expression evaluates to TRUE

Generated UI Mockup — showing expanded properties
Expression
-
x
Name:
Label this brick...
Expression:
True
v

Properties

Property

Type

Default

Notes

Expression

string

True

Boolean expression (e.g., ‘True’, ‘False’, or GDScript expression)

Example Use Cases

Complex Door Unlock:

Expression: (key_red AND key_blue) OR (lever1 AND lever2 AND lever3)
// Door opens if have both keys OR all 3 levers pulled

AI Attack Decision:

Expression: can_see_player AND (health > 50 OR has_backup) AND NOT retreating
// Attack if see player AND (healthy OR has backup) AND not retreating

Puzzle Solution:

Expression: (switch1 XOR switch2) AND switch3 AND NOT switch4
// Puzzle solved if switches in specific pattern