-
Notifications
You must be signed in to change notification settings - Fork 0
DSL: expressions
An expression is a typed operation that computes arguments and returns something.
As with types, the content is evaluated at runtime.
There are a few statements, but they are powerful enough.
Check the types list to include a typed expression.
- Array :
[[<a>, <b>, ...]]: a homogenous collection of elements. - Properties :
{{ <key_1>: <value_1>, <key_2>: <value_2>, ... }}: a map of elements. - Location :
@(<world_name>, <x>, <y>, <z> [, <yaw>, <pitch>]): a location in a world.
You can call a function using the syntax: <function_name>([args...]). If way return something.
You'll learn more about function in its dedicated page.
Get a list of entities of a specific scope around a Location.
Syntax: all <SCOPE> within <DISTANCE> around <SOURCE> [including]
-
SCOPEa scope to filter entities with. Can be an EntityType or a Custom identifier. If it's the latter, see the ScopeProvider. -
DISTANCEis a Number. -
SOURCEis either an Entity or a Location. - If the keyword
includingat the end, the source will also be included in the list (if the source is an Entity).
Returns: a Collection of Entities.
Example:
define %monsters = all monsters within %distance around %caster;
define %everyone = all entities within 30 around %caster includingGet the Location of an Entity.
Syntax: position of <SOURCE>
-
SOURCEthe Entity to get the Location of. Accepts collections.
Return a Location. If the SOURCE is a collection, returns a collection of Locations.
Example:
teleport %caster to (position of %some_entity);Get the size if a collection.
sizeof <COLLECTION>-
COLLECTION: a Collection. If a single element is provided, will return 1.
Return a Number, with the size of the collection.
Example:
# With a 'define' equals to all monsters around
define %count = sizeof(%monsters);
send to %caster message "There are&c %count&f monsters around !";