Definition_Example: type: world debug: false events: on defs command: - determine passively fulfilled - define args ']: || li@This|is|a|default|sentence|you|silly!>' - run locally defs instantly def:%args% defs: - define defs # We can use at the beginning of a new queue to show all # the definitions that were passed to it. - narrate "<&sp><&3><&n>Queue Definitions" - narrate "" # To illustrate, the output here is the definition name %def% followed by # the definition value - foreach %defs% { - define def %value% - narrate "<&sp><&sp><&sp><&6>%def%<&co> <&f>" } # Not quite the output you would expect. That's because the # list is built from an internal (to denizen) hashmap - narrate "" - narrate "*--------" - narrate "" # Since the list %defs% we are working with was passed from a run command, # the definition names are the order index li@1|2|3... as seen above. This # is helpful since the order of the list %defs% was disturbed by using the # tag. We can sort this list by number order using the # tag. - narrate "<&sp><&3><&n>Sorted List - Numeric" - narrate "" - define sortedDefs # Now that we have out list of definitions back in the correct order, let's # reconstruct the sentence you entered. - define sentence li@ # You must create an empty list object so it's available when we try to add # data to it. Bad things happen with non-existent lists! # The value being added to the list is the word in your sentence, not the # definition name! - foreach %sortedDefs% { - define def %value% - narrate "<&sp><&sp><&sp><&6>%def%<&co> <&f>" - define sentence ']>' } - narrate "" # Let's display the list of definition names in sorted order. - narrate "<&sp><&3>Definition name order reconstructed<&co> <&f>" - narrate "" # And finally your reconstructed sentence. - narrate "<&sp><&3>Your string reconstructed<&co> <&f>" - narrate "" - narrate "*--------"