Description: Shows how to use a simple 'loop through'. 'Loop Through' is a script that is included with Denizen to allow a script to be run for each item in a flag list, thus providing a simple 'for each' ability.
use - run 'loop through' d:[task_name]|[flag name]|[flag type, global/player/npc] instantly
# +-----------------------------------# | Loop through tester# +-----------------------------------
Loop Through Tester:
type: world
events:
on testloop command:
# Tell bukkit the command was handled.
- determine passively fulfilled
# Create a test flag with 3 items.
- flag server testloop:|:item1|item2|item3
# Run the loop through script, give it some definitions.# 'testtask' is now run for each item in the list.
- run 'loop through' d:testtask|testloop|global instantly
# Remove the test flag that was made.
- flag server testloop:!
testtask:
type: task
context: iterator
script:
- narrate '<c.iterator>'