Skip to main content

Select

The Select statement allows you to execute a list of Statements only if the when Condition is true.

select(cases: SelectCase[]): Statement
select(cases: SelectCase[], default: Statement[]): Statement

The SelectCase array defined by cases is checked in order. Only the first case where the check (see below) is true is executed. A default array may be provided, which will run if and only if none of the cases do.


when(check: Condition, do: Statement[]): SelectCase

A single case used as part of a larger Select Statement. The Statements in do will only be executed if the check is true.


Examples

select(
[
when(level >= 15, [
set(skill_proficiency(lore("Starfinder")), legendary)
]),
when(level >= 7, [
set(skill_proficiency(lore("Starfinder")), master)
]),
when(level >= 3, [
set(skill_proficiency(lore("Starfinder")), expert)
]),
],
[set(skill_proficiency(lore("Starfinder")), trained)]
)

Become trained in Starfinder lore, increasing proficiency at 3rd, 7th and 15th level.


select([
when(
level >= 5,
[
set(
equipment_critical_specialization(equipment_weapon_category(eq(simple_weapon))),
true
)
]
)
])

Grant Critical Specialization effects for Simple weapons at level 5.