Skip to main content

over

Repeats its body for each player in the player variable or a value in a collection variable, assigning it its own custom variable.

Syntax

over @players with @item [$index]

Example

# Run once for every player.
over @all
Print "Hello, {@sender -> name}!"
end

# Bind the current item to a temporary variable.
over @all with @plr
Print "found player {@plr -> name}"
end

# Collections can be iterated in the same way.
&inventory = @sender -> inventory
over &inventory with *item
Print "found item {*item -> type}"
end

# Add a 1-based index as a second binding.
over @all with @plr $index
Print "found player #{$index}: {@plr -> name}"
end

# Use break to leave the loop or continue to skip to its next iteration.