User Tools

Site Tools


concepts:dynamic_objects

Dynamic Objects

I think the best way to explain dynamic objects is to differentiate them from variables: variables are designed to refer to aspects of your show that are part of its fabric - the status of content in a room, the pressure in an air line, or whether a door is open or closed. The dynamic object feature is for things that are created during the show, the most obvious application being information about individual audience members - although there is nothing about them that would restrict them to being used for anything else.

Structure

A dynamic object has two properties:

  • A unique identifier (UID) - this can be supplied by the user (from an RFID UID, or from a ticketing database for example), or generated automatically when the object is created.
  • The data - a collection of name/value pairs. So, for example, the data for an audience member might look like:
    • firstName = John
    • lastName = Smith
    • group = Red-14:30
    • intervalDrink = true

Note that the UID can also be queried as part of the data, but not set

In assigning names and values to items in data, bear in mind the comments on reserved characters on this page.

Interaction

To start to understand how to interact with dynamic objects, have a look at the relevant commands. You'll see that, broadly, there are two sets of commands:

  • Commands where the UID is a given - you're referring to a known object
  • Commands where the object must be found given a set of statements about its data. Note that, in the case of set_findobject, if the statements given refer to more than one object, the first one found that meets the criteria will be used.

Whilst experimenting and programming a show, there is also an interface for examining currently known objects: the button next to the console button will spawn it. Entering a statement 1) in the box at the top will list all objects meeting that criteria. Pressing return on an empty box will list all objects.

References

Here's the fun2) part - dynamic object data value can be in-lined like variable references. But rather than using the $zone.variable syntax, we use:

{<qualifier> | <value name>}

The qualifier is either:

  • The known UID of a dynamic object, or
  • A statement of name/value pairs used to find the object3).

The value name identifies the value in the data that then replaces the reference.

So, given a dynamic object with the UID 12345 and the data listed for the audience member above:

{ 12345 | firstName } will resolve to John

{ firstName=John, lastName=Smith | intervalDrink } will resolve to true

A dynamic object reference that fails to find an object or associated value will resolve to null

Note, that like variable references, dynamic object references will only be interpolated up to the first occurrence of ::, which is the delimiter used for commands that are parameters of other commands - so these parameter commands will be passed with references intact.

Special Value

All objects have two values that can be queried but not written to:

  • uid returns to object's UID. So, if you have a macro that needs to find an object and then do a series of things with it, you could make the macro less verbose by finding the uid first, and the using that in following commands
  • json returns the object as a json string, to allow you (for example) to pass information about an object to another system.
1)
A comma-separated list of name/value pairs, like: value1=this, value2=that, etc…
2)
Complicated
3)
Again, as above, if the qualifier is true for more than one object, the first found will be used
concepts/dynamic_objects.txt · Last modified: 2024/09/20 07:47 by 127.0.0.1