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

Routine: Foreach Loop

1cec0ld edited this page Dec 13, 2012 · 3 revisions

Allows you to go through every entity and do something with/to them.

Syntax

- 'for|each {filter} in ({world}|server) as {newname}':
    - 'more routines using newname'

{filter} - Any entity that can be used as the filter in the Nearby Routine.
{world}|server - The world name you want to affect. Use Server if you want all worlds affected. {newname} - A custom label you want to give all entities selected by this. Much like 'it' in the Nearby Routine.

How it works

Nested under the routine, the {newname} entity reference refers to the selected entity, and the routines will be run on each entity in the world/server.

Examples

Feeling generous

Command:
    - 'party':
        - 'foreach player in server as named':
            - 'namedeffect.dropitem.diamond'
Clone this wiki locally