begin
Opens an explicit sub-block inside an action scope. Although the compiler lowers begin to an action opcode, in source it behaves like a scope element alongside condition, action, temporary, and or.
The primary shipped use is if/elseif-style branching: several begin/end pairs in sequence, where each block has its own conditions. If a condition inside one block fails, only that block halts — the next begin block still runs.
Example from Winter Contingency
Reach MCC's tu1_winter_contingency.txt rewrote a round-timeout winner check using begin blocks inside action for_each team. Each block tests a different frozen-player count and updates tie-tracking state:
trigger general
condition if round_time_limit > 0
condition timer_expired round_timer
temporary number least_frozen_players k_maximum_team_size
temporary team least_frozen_players_team none
action for_each team
action set active_teams_count += 1
condition team_is_active current_team
begin
condition if current_team.players_frozen == least_frozen_players
action set teams_tied = true
end
begin
condition if current_team.players_frozen < least_frozen_players
action set least_frozen_players = current_team.players_frozen
action set least_frozen_players_team = current_team
end
end
endWithout begin, flat conditions would AND together — the first failing comparison would halt the rest of the iteration. Separate blocks let each branch run independently, like if / else if.
The same trigger in HREK still contains the older Reach pattern in comments: a single for_each body with or-chained conditions acting as elseif branches. MCC added the begin opcode (ported from Halo 4) so that logic could be expressed as explicit sub-blocks instead.
Syntax
begin is written on its own line, not as action begin:
begin
[<conditions, actions, temporaries, nested begin/end pairs>]
endLegal contents match any other action scope: condition, or, action, temporary, and nested begin/end pairs.
Where it appears
begin blocks are valid anywhere an action scope is valid:
- Inside a
triggerbody - Inside an
action for_eachsub-trigger - Nested inside another
beginblock
Rules
Independent blocks — Sequential begin/end pairs are evaluated one after another. A false condition inside block N does not prevent block N + 1 from running.
Action budget — Each begin line counts as one action toward the script's 1024-action limit, in addition to the actions inside the block.
Temporary variables — temporary declarations inside a begin block are scoped to that block (and any nested blocks inside it).
See also
- trigger — Action scope — keywords valid inside triggers
- trigger — execution and
for_each - Conditions — OR — the pre-
beginelseif pattern - action — imperative opcodes inside blocks
- Variable model — Temporary variables