Container Element
Container Element

Container Element

Containers, much like rooms and players and the world, can contain objects and variable context. However, nothing in a container is accessible.

Containers are useful for containing objects that need to be tagged or bulk-moved to other containers, or keeping track of other object-like things that could be useful, like objective lists or the like, since they can be browsed like any other thing that can contain objects.

Declaration


	container [INDENTIFIER] [INHERITANCE_CLAUSE]
	{
		/* Lifecycle */
		init() { ... }
	}
[IDENTIFIER] An internal identifier that represents this container in the rest of TAMEScript. This identifier must not be used to describe another element.
[INHERITANCE_CLAUSE] If this container inherits entry points and functions from another container, you declare its parent container by adding a colon (:) plus the identifier of the parent container.

Entry Blocks

Command Name Parameters Description
Init None Called at module context initialization on each element.

Archetyping

The keyword archetype can be used to create containers that have common functions and entry points to share among similar containers. Archetyped containers can inherit from other parent containers and archetyped containers.

Archetyped containers also cannot be used in commands as through they were real elements. Archetypes also do not hold a context state, nor is their context state saved.


	container archetype [INDENTIFIER] [INHERITANCE_CLAUSE]
	{
		/* Lifecycle */
		init() { ... }
	}

Prototyping and Extending

TAMEScript's compiler is single-pass: it parses through the module code once, so if the compiler encounters a container identifier that has not been declared yet, it may need to be prototyped.

Prototyping a container is essentially declaring a container, but with a semicolon after its main declaration instead of a declaration body wrapped in curly-braces ({ }). A parent container to inherit from, if any, will need to be declared here.

If you have already declared a container as a prototype (or with a declaration body) and wish to add to it later in code, you'll need to extend it using the extend keyword. When using extend, you cannot change its lineage (parent).


	container c_todolist;
	
	extend container c_todolist
	{
		/* ...stuff goes here... */
	}

Useful Tips

Libraries

The nice thing about containers is that they are blank slates that hold context but also are not technically connected to the world, so they are ideal for acting as static, include-able libraries for helper functions and special gamestates that may not be included in the world.

Container Element

Container Element

×

Modal Header