Pick

Returns a deterministic random element from a list, keyed by a slot name. The same slot always returns the same element for the life of the run, useful for stable cosmetic flavor (a greeting line, a bark) that shouldn’t change every time the expression is evaluated.

Category: Sequence Returns: any (matches the element type)

Signature

Pick(slotKey, list)

The first argument is a slot name: any string. The second is the list to pick from, either a list literal or a list-typed variable.

Examples

Pick("greet_inn", ("Hello.", "Hi.", "Hey."))
                                // returns one of the three, stable for the run
Pick("npc_bark", var_idle_lines)
                                // pick from a list-typed variable
Pick("slot_a", var_dialogue_options) + " " + Pick("slot_b", var_dialogue_options)
                                // two independent picks from the same list, via distinct slots

Notes

The picked element is determined by the pair of the run’s master seed and the slotKey. Two Pick("greet", list) calls with the same slotKey always return the same element for the run; calls with a different slotKey draw independently. The same rule governs Cycle and Once.

Unlike Cycle and Once, Pick keeps no memory of past calls: every call recomputes the same result from the seed and the slot key. A snapshot-restored game reproduces the same pick because the run’s seed is stable across save and restore, not because anything about the pick itself was saved.

An empty list, or a variable holding one, returns an empty string rather than raising an error.

Pick a unique slotKey for each call site that needs distinct behavior. Two Pick("greeting", list) calls in different nodes share the same slot.

Docs last synced: 2026-07-08
Screenshot viewer