Trigger and Events

In Toto there are different events that are fired when a user plays a session. These are defined on the different content entities. For instance the event on task solve can be defined on an element of type task.

For each trigger event you can define:

Trigger events

There are currently 11 different events available for defining a trigger:

name description
on story initialize Fires when a story has been initialized.
on story join Fires when another player joined a game session.
on story start Fires when the story has been started.
on story cancel Fires when a story has been canceled which means the user quits the story before finishing it.
on story finish Fires when a story has been finished. As soon as the last element of the last story is done, the user can finish the story regardless if there are still unsolved elements.
on challenge release Fires when a challenge has been released.
on challenge finish Fires when a challenge has been finished which means the last element of that challenge has been processed successfully, even if there are other elements in the challenge graph which haven’t been processed successfully by the user yet.
on task release Fires when a task has been released.
on info release Fires when an info element has been released.
on choice release Fires when a choice has been released.
on dynamic release Fires when a dynamic element has been released.
on task solve Fires when a task has been solved (processed successfully).
on task skip Fires when a user skipped a task.
on task error Fires when a user entered a wrong solution.
on info acknowledge Fires when an info element has been acknowledge (processed successfully).
on coin collect Fires when a coin has been collected.
on choice make Fires when a choice has been made (processed successfully).
on dynamic success Fires when a dynamic element has been processed successfully.
on dynamic error Fires when a dynamic element couldn’t be processed successfully.

The order of this list determines the order in which these events will be fired.

Example

You have a story with two challenges C1 and C2. In C1 you’ve created two tasks T1 and T2 and in B there are two tasks as well: T3 and T4. If the user solves T2, then the following events are fired:

  1. T2: on element success
  2. C1: on challenge finish
  3. C2: on challenge release
  4. T3: on element release

Variable scripts

For each defined variable you can execute a script and change the value of a particular instance of that variable. Depending on the scope there are instances for the repository, the user or the session.

Variable scripts are always executed and updated before payloads are sent to TotoObjects.

Please see section variables for more information.

TotoObject payloads

You can sent arbitrary payloads to TotoObjects. The payload is just a simple string and the data depends on the object which is referenced. There are different TotoObjects available:

You can of course create your own TotoObject.

Please see section objects for more information.