Repeating While Loop (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.9.0

Syntax

while <.+> repeating every %timespan% [globally]

Description

Similar to Skript's while loop, this while loop will repeat at the given timespan. It is recommended to NOT use a wait within these sections, as the section will repeat regardless.

**Patterns**: The 2nd pattern is only of concern if you are running Folia or have Paper schedulers enabled in the config, otherwise just use the first pattern. - `globally` = Will run this loop on the global scheduler (Use this for non entity/block related tasks). - `for %entity` = Will run this task for an entity, will follow the entity around (region wise)and will cancel itself when the entity is no longer valid. - `at %location%` = Will run this loop at a specific location (Use this for block related tasks).

Examples

on entity added to world:
	if event-entity is a wolf:
		while event-entity is valid repeating every 1 seconds:
			set {_p} to nearest player in radius 15 around event-entity
			if {_p} is set:
				set target of event-entity to {_p}

View source