Loop Through Test


Author: aufdemrand
Created: 2013-08-16T07:41:45-0400
Edited: 2013-08-16T07:58:39-0400
Denizen Version: 0.9.2+
Views: 4
Downloads: 850
Likes: 0


WGET
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>'




Comments
No one has posted a comment! Post one below: