Loop value (Expression) — Skript

Addon: Skript · Category: Expression · Since: 1.0, 2.8.0 (loop-counter), 2.10 (previous, next)

Syntax

[the] [current] loop-<.+>

Description

Returns the previous, current, or next looped value.

Examples

# Countdown
loop 10 times:
	message "%11 - loop-number%"
	wait a second
# Generate a 10x10 floor made of randomly colored wool below the player
loop blocks from the block below the player to the block 10 east of the block below the player:
	loop blocks from the loop-block to the block 10 north of the loop-block:
		set loop-block-2 to any wool
loop {top-balances::*}:
	loop-iteration <= 10
	send "#%loop-iteration% %loop-index% has $%loop-value%"
loop shuffled (integers between 0 and 8):
	if all:
		previous loop-value = 1
		loop-value = 4
		next loop-value = 8
	then:
		 kill all players

View source