Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Routine: While Loop

Deide edited this page Jan 8, 2013 · 3 revisions

Loop through routines until statement is false.

Syntax

- 'while [statement to test]':
    - 'Do stuff here"

How it works

It's basically the same as an if statement, except that it loops until the statement is false

Examples

Get the first air block at a certain location and spawn a chest there.

- 'set.$x': 'rand(1, 300)'
- 'set.$y': '1'
- 'set.$z': 'rand(1, 300)'
- 'while world_block($x, $y, $z)_typeid !== 0':
    - 'message.server': "[LOG] Loop no.%{$y}"
    - 'set.$y': '$y + 1'
- 'set.world_block($x, $y, $z)_typeid': '54'
Clone this wiki locally