# SEXPs

A SEXP (Symbolic EXPression) is the scripting language built into FreeSpace missions. Every condition, trigger, and action in a mission — from checking whether a ship has been destroyed to playing a message — is expressed as a SEXP tree.

## Structure

SEXPs use a Lisp-style prefix notation enclosed in parentheses:

    (operator argument1 argument2 ...)

Operators can be nested, so arguments can themselves be SEXPs:

    (when
        (is-destroyed-delay 0 "Epsilon 1")
        (send-message "" "Mission-Complete" "Command")
    )

Here `when` is the top-level operator. Its first argument is a condition (`is-destroyed-delay`) and its second argument is an action (`send-message`). When the condition becomes true the action fires.

## Where SEXPs appear

SEXPs are used in:

- Mission Events — the primary place to author SEXP logic; see the Mission Events dialog.
- Mission Goals — the completion condition for each goal; see the Mission Goals dialog.
- Ship arrival/departure cues — conditions on when ships enter and leave the mission.
- Briefing and debriefing — stage-change conditions.

## Editing SEXPs in QtFRED

The SEXP tree editor is embedded directly in the Mission Events and Mission Goals dialogs. Right-click any node in the tree to add, replace, or remove operators and arguments. Hover over an operator name for a brief description of what it does.

Note: The full SEXP reference is maintained on the Hard Light Productions wiki.