Loop Iteration (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.8.0

Syntax

[the] loop(-| )(counter|iteration)[-%-*number%]

Description

Returns the loop's current iteration count (for both normal and while loops).

Examples

while player is online:
	give player 1 stone
	wait 5 ticks
	if loop-counter > 30:
		stop loop
loop {top-balances::*}:
	if loop-iteration <= 10:
		broadcast "#%loop-iteration% %loop-index% has $%loop-value%"

View source