Skip to main content

Event

An Event is the main form of communication between resource instances in the app. Events consist of a name and payload, which can contain extra information that can be accessed by stats and mechanics triggered by the event.

An Event should represent something that occurs that others might be interested in knowing. For example, "cast_spell", "roll_attack" or "equip_armor" could all be reasonable events to have.

Events are more often than not fired by user actions, but they could also be fired by mechanics or even the RPG Companion App itself (see Character Sheet Lifecycle). As such, they are a very powerful concept that will allow you to bring life to your system and also avoid repetition when designing it.

JSON Format

{
"type": "Event",
"name": ...,
"payload": ...
}

Fields

FieldTypeRequiredDescription
nameStringThe name for the event.
payloadMap<String, dynamic>Optional. The payload to send with the event. This consists of a key-value map. For example, for a "roll_stat" event, you might have: json { "stat": "strength" }