1. Here be dragons !

If you are reading this section of the document, you have a particular interest in "the bleeding edge".

These are experimental features of Adventuron that are likely that may change in the future, and require re-engineering in any game that uses them

It is highly unlikely that any feature in this section will be removed, but they may be restructured, renamed, or otherwise tampered with.

2. About The Syntax

Adventuron sits atop of an object notation language called RION, which is essentially a hierarchical object notation, simular to XML and JSON.

RION makes it easier to represent conditional logic that JSON, XML, and YAML as it allows embedded scripting.

3. Collections

Warning
Please note that all items in a collection are typed as text. If you want to cast the text to a number then use the int() function.

3.1. collection_clear

This will clear down an

   : collection_clear "my_list_1";

3.2. collection_get

collection_get is a string function that returns a string result

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list {
      items     = [
         one,
         two,
         three,
         4,
         5
      ]
   }
}

on_startup {
   // collection_get will always return a string type
   : print {(
      collection_get{
         collection -> ("my_list")
         index -> ( 2 )
      }
   )}
   // Will print 20, 4th list element multiplied by 3rd list element
   // We add the + "" at the end to cast to a string.
   : print {( (int(collection_get{ collection -> ("my_list") index -> ( 4 ) }) *
      int(collection_get{ collection -> ("my_list") index -> ( 3 ) })) + "" )}
   : press_any_key ;
}

3.3. collection_count

Counts the number of elements in a collection.

: if (collection_count("my_list") > 0) {
   : print "There is more than one item in the list";
}

3.4. collection_intersect

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list_1 : list {
      items = [  dog, cat, poodle ]
   }
   my_list_2 : list {
      items = [  dog, poodle ]
   }
   my_list_3 : list;
}

on_startup {
   // store the common items between list 1 and list 2 in list 3
   : collection_intersect {
      collection_1 = my_list_1
      collection_2 = my_list_2
      result       = my_list_3
   }
   : collection_iterate "my_list_3" {
      : print {(item())}

   }
   : press_any_key ;

}

3.5. collection_iterate

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list {
      items     = [
         one,
         two,
         three,
         four,
         five
      ]
   }
}

on_startup {
   // Iterates over each element in 'my_list'
   // The item() function will return the string
   // at the current element. item() always returns
   // a string, so you will need to wrap in int()
   // to process as a number.
   : collection_iterate "my_list" {
      : print {(item())}
   }
   : press_any_key ;
}

3.6. collection_modify

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list;
}

strings {
   tmp : string ;
}

on_startup {

   : collection_push { collection = "my_list" content -> ("one") }
   : collection_push { collection = "my_list" content -> ("two") }
   : collection_push { collection = "my_list" content -> ("three") }
   : collection_push { collection = "my_list" content -> ("four") }
   : collection_push { collection = "my_list" content -> ("five") }
   : collection_modify { collection = "my_list" index -> (0) content -> ("ONE") }
   : collection_modify { collection = "my_list" index -> (2) content -> ("THREE") }

   : collection_iterate "my_list" {
      : print {(item())}
   }
   : press_any_key ;
}

3.7. collection_push

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list;
}

on_startup {

   : collection_push { collection = "my_list" content -> ("one") }
   : collection_push { collection = "my_list" content -> ("two") }
   : collection_push { collection = "my_list" content -> ("three") }
   : collection_push { collection = "my_list" content -> ("four") }
   : collection_push { collection = "my_list" content -> ("five") }

   : collection_iterate "my_list" {
      : print {(item())}
   }
   : press_any_key ;

}

3.8. collection_pop

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list;
}

strings {
   tmp : string ;
}

on_startup {

   : collection_push { collection = "my_list" content -> ("one") }
   : collection_push { collection = "my_list" content -> ("two") }
   : collection_push { collection = "my_list" content -> ("three") }
   : collection_push { collection = "my_list" content -> ("four") }
   : collection_push { collection = "my_list" content -> ("five") }

   : collection_iterate "my_list" {
      : print {(item())}
   }

   : print "-----";
   : collection_pop  { collection = "my_list" var = "tmp" }
   : print {(tmp)}
   : collection_pop  { collection = "my_list" var = "tmp" }
   : print {(tmp)}
   : collection_pop  { collection = "my_list" var = "tmp" }
   : print {(tmp)}
   : collection_pop  { collection = "my_list" var = "tmp" }
   : print {(tmp)}
   : collection_pop  { collection = "my_list" var = "tmp" }
   : print {(tmp)}
   : press_any_key ;
}

3.9. collection_remove

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list {
      items     = [
         one,
         two,
         three,
         4,
         5
      ]
   }
}

on_startup {
   : collection_remove { collection -> ("my_list") index -> (1) }
   : print {( collection_get{ collection -> ("my_list") index -> ( 2 ) } )}
   : press_any_key ;
}

3.10. collection_sort

Note
In the following example, the item() function returns the textual content of the next item in the list.
start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list : list {
      items     = [
         one,
         two,
         three,
         four,
         five
      ]
   }
}

on_startup {
   : collection_sort collection = "my_list" algorithm = "shuffle" ;
   : collection_iterate "my_list" {
      : print {(item())}
   }
   : press_any_key ;
}

3.11. collection_subtract

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list_1 : list {
      items = [  dog, cat, poodle ]
   }
   my_list_2 : list {
      items = [  dog, poodle ]
   }
   my_list_3 : list;
}

on_startup {
   // store the common items between list 1 and list 2 in list 3
   : collection_subtract {
      collection_1 = my_list_1
      collection_2 = my_list_2
      result       = my_list_3
   }
   : collection_iterate "my_list_3" {
      : print {(item())}

   }
   : collection_clear "my_list_1";
   : press_any_key ;

}

3.12. collection_union

Stores the common elements between two collections in a third collection. Duplicates are removed.

start_at = my_location

locations {
   my_location : location "You are in a room." ;
}

collections {
   my_list_1 : list {
      items = [  dog, cat, poodle ]
   }
   my_list_2 : list {
      items = [  dog, poodle, bat ]
   }
   my_list_3 : list;
}

on_startup {
   // store the common items between list 1 and list 2 in list 3
   : collection_union {
      collection_1 = my_list_1
      collection_2 = my_list_2
      result       = my_list_3
   }
   : collection_iterate "my_list_3" {
      : print {(item())}

   }
   : press_any_key ;

}

3.13. Listing subobjects

start_at = my_location

locations {
   my_location      : location "You are in a room." ;
}

objects {

   cupboard : scenery "{cupboard_description}"
      at             = "my_location"
      container_type = "bag"
   ;

   book     : object "a book" at = "cupboard" ;

   bowl     : object "a bowl" at = "cupboard" ;

}

collections {
   list_object_buffer : list;
}

strings {
   cupboard_description : string;
}

on_pre_describe {
   : if (is_present "cupboard") {
      : set_string var = "cupboard_description"  text = "a cupboard" ;
      : if (child_count "cupboard" > 0) {
         : look_inside
            of               = "cupboard"
            extract_the      = "description"
            store_results_in = "list_object_buffer"
            make_known       = "true"
         ;
         : print_list_verbose  "list_object_buffer"
            lead_in       = " (containing "
            final_part    = ")"
            append_to_var = "cupboard_description"
         ;
      }
   }
}