Tapestry
Source Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Object

Operations on objects, variables, and kinds.

Definitions:

Slots:

  • Dot: Access values stored inside other values.

Commands:

Commands

Select a named field from a record, or a named property from an object.

Slots:

Terms:

field: TextEval

The name of the field to read or write. The field must exist in the object or record being accessed.

Select a value from a list of values.

Slots:

Terms:

index: NumEval

The one-based index to read or write. The index must exist within the list being targeted.

Change to the previous state in some particular set of states for a given object ( or record. ) Optionally, returns the new value of the state. Uses the order of the states where as they were originally defined. See [DefineState].

Slots:

Terms:

Decrease: Address

The object or record in question.

state: TextEval

The name of the set of states in question. See also [DefineState].

by: optional NumEval

Customize the size of the decrement. When not specified, decrease by a single step.

clamp: optional BoolEval

Customize the behavior of decrement when the first state has been reached. If clamp if false ( or not specified ), decrement will wrap around to the last state. When clamp is true, decrement will stick to the first state.

A list of the fields of a given kind.

Slots:

Terms:

of: TextEval

The kind in question.

Change to the next state in some particular set of states for a given object ( or record. ) Optionally, returns the new value of the state. Uses the order of the states where as they were originally defined. See [DefineState].

Slots:

Terms:

Increase: Address

The object or record in question.

state: TextEval

The name of the set of states in question. See also [DefineState].

by: optional NumEval

Customize the size of the increment. When not specified, increase by a single step.

clamp: optional BoolEval

Customize the behavior of increment when the last state has been reached. If clamp if false ( or not specified ), increment will wrap around to the first state. When clamp is true, increment will stick to the last state.

Determine whether an object (or record) is compatible with the named kind. For example, all containers are a kind of prop. Asking if a container is a kind of a prop would return true. See also [IsExactKindOf].

Slots:

Terms:

compatible: Address

The object or record in question.

kind: TextEval

The kind to check.

nothing: optional Bool

Check whether the requested text of the object is empty but the type of the requested text is still of requested kind.

Determine whether an object (or record) is of exactly the named kind. For example, all containers are a kind of prop. Asking if a container is exactly a prop would return false. See also [IsKindOf].

Slots:

Terms:

exactly: Address

The object or record in question.

kind: TextEval

The kind to check.

The kind of an object or record.

Slots:

Terms:

of: Address

The object or record in question.

nothing: optional Bool

Check whether the requested text of the object is empty but the type of the requested text is still of requested kind.

Read a value from an object. As a special case, if there are no dot parts, this will return the id of the object. In .tell files, this command is often specified with a shortcut. For example:

"#my_object.some_field"

is a shorter way to say:

Object:dot:
- "my object"
- "some field"

WARNING: This doesn't convert values from one type to another. For instance, if a field was declared as text, this will error if read as a boolean.

Slots:

Terms:

Object: TextEval

Id or friendly name of the object.

dot: optional Dot repeats

A field or path within the object to read from.

The full name of an object as originally specified by the author. Generates an error for unknown objects except it returns empty text when given empty text. See also [ObjectDot] which can return the object's unique id.

Slots:

Terms:

name: Address

The object in question. ( Records don't have names. )

All of an object's current states as a list of text. ( Despite the name, can also be used on records. )

Slots:

Terms:

states: Address

The object or record in question.

A list of all objects accessible by the current scene that compatible with the specified kind.

Slots:

Terms:

of: TextEval

The kind in question.

Set the state of an object or record. See also: story `Define state:names:`.

Slots:

Terms:

Set: Address

Object or record to change.

state: TextEval

Name of the state to set. Only one state in a state set is considered active at a time so this implicitly deactivates the other states in its set. Errors if the state wasn't declared as part of the object's kind.

Store a value into a variable or object. Values are specified as a generic [Assignment]. The various "From" commands exist to cast specific value types into an assignment.

WARNING: This doesn't convert values from one type to another. For example:

Set:value:
- "@some_local_variable"
- FromText: "a piece of text to store."

will only work if the local variable can store text. If the variable was declared as a number, the command will generate an error.

Slots:

Terms:

Set: Address

Object property or variable into which to write the value.

value: Assignment

The value to copy into the destination.

Read a value from a variable. In .tell files, this command is often specified with a shortcut. For example:

"@some_local_variable"

is a shorter way to say:

Variable:dot: "some local variable"

WARNING: This doesn't convert values from one type to another. For instance, if a field was declared as text, this will error if read as a boolean.

Slots:

Terms:

Variable: TextEval

Exact name of the variable in question.

dot: optional Dot repeats

The field or path within the variable to read from. Specifying a dot only makes sense when the variable contains a record, a list, or the id an object. When this isn't specified, the command returns the value of the variable itself.