# new RezEvent()
Represents a game event response in the Rez game engine. Events are used to communicate the results of user interactions and specify what actions should be taken (scene changes, card plays, flash messages, etc.). Supports method chaining for building complex event responses.
Example
// Create an event that plays a card and shows a message
return RezEvent.playCard("next_card").flash("Moving forward!").render();
Methods
# after(callback) → {RezEvent}
Adds a callback to be run after event processing is finished
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function
|
a parameterless callback the runs after processing |
this event for method chaining
# banner(message, optionsopt) → {RezEvent}
Sets an auto-dismissing banner message displayed full-width across the viewport
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
message |
string
|
message to display in the banner |
||
options |
object
|
<optional> |
{} | optional config; supports |
this event for method chaining
# bannerConfig() → {object|null}
the banner config ({message, cssClass, onscreen, dark, vpos}), or null
object
|
null
# cardId() → {string|null}
ID of the card to play, or null if no card action
string
|
null
# error(message) → {RezEvent}
Sets this event as an error with the specified message
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
error message |
this event for method chaining
# errorMessage() → {string|null}
error message if this is an error event, or null
string
|
null
# flash(message, kind) → {RezEvent}
Adds a flash message to be displayed to the user
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
message to display as a flash |
kind |
string
|
optional notification kind (default: "") |
this event for method chaining
# flashMessages() → {Array.<string>}
array of flash messages to display
Array.<string>
# hasBanner() → {boolean}
true if this event has a banner message to display
boolean
# hasFlash() → {boolean}
true if this event has flash messages to display
boolean
# hasModalCard() → {boolean}
true if this event has a card to display in a modal
boolean
# hasModalMessage() → {boolean}
true if this event has a modal message to display
boolean
# hasQueuedEvents() → {boolean}
true if this event has follow-up events to raise
boolean
# modalCard(cardId, paramsopt, optionsopt) → {RezEvent}
Sets a card to be displayed as a modal dialog
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cardId |
string
|
ID of the card to render in the modal |
||
params |
object
|
<optional> |
{} | optional params passed to the card on will_embed |
options |
object
|
<optional> |
{} | display options for the modal |
showDismiss |
boolean
|
<optional> |
true | when false, suppresses the default OK dismiss button so the card can supply its own dismiss control |
animation |
string
|
<optional> |
"scale" | entrance animation, one of
|
animationDuration |
number
|
<optional> |
180 | animation duration in ms |
this event for method chaining
# modalCardConfig() → {object|null}
the modal card config ({cardId, params, showDismiss}), or null
object
|
null
# modalMessage(message, optionsopt) → {RezEvent}
Sets a modal message to be displayed to the user
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
message |
string
|
message to display in the modal body |
||
options |
object
|
<optional> |
{} | optional config |
title |
string
|
<optional> |
optional modal title |
|
animation |
string
|
<optional> |
"scale" | entrance animation, one of
|
animationDuration |
number
|
<optional> |
180 | animation duration in ms |
this event for method chaining
# noop() → {RezEvent}
No-operation method for method chaining when no action is needed
this event for method chaining
# params() → {object}
the parameters object associated with this event
object
# playCard(cardId) → {RezEvent}
Sets this event to play the specified card
Parameters:
| Name | Type | Description |
|---|---|---|
cardId |
string
|
ID of the card to play |
this event for method chaining
# queueEvent(eventName, paramsopt, optsopt) → {RezEvent}
Queues a follow-up event to be raised after this response has been
dispatched (and rendered). The event fires asynchronously after delay ms, allowing
the browser to paint the current render before the next event runs. This drives paced
sequences such as a monster taking several actions in a row. While a locking queued
sequence is in flight the event processor is "busy" and player-initiated events are
ignored, preventing the player from interfering mid-sequence.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
eventName |
string
|
the name of the event to raise after this response |
||
params |
object
|
<optional> |
{} | parameters passed to the queued event's handler |
opts |
object
|
<optional> |
{} | options: |
this event for method chaining
# queuedEvents() → {Array.<object>}
array of queued event descriptors {eventName, params, target, delay, lock}
Array.<object>
# renderEvent() → {boolean}
true if this event should trigger a view render
boolean
# sceneChange(sceneId) → {RezEvent}
Sets this event to change to the specified scene
Parameters:
| Name | Type | Description |
|---|---|---|
sceneId |
string
|
ID of the scene to change to |
this event for method chaining
# sceneChangeEvent() → {boolean}
true if this event should trigger a scene change
boolean
# sceneId() → {string|null}
ID of the scene for scene transition, or null if no scene action
string
|
null
# sceneInterlude(sceneId) → {RezEvent}
Sets this event to start an interlude with the specified scene
Parameters:
| Name | Type | Description |
|---|---|---|
sceneId |
string
|
ID of the scene to interlude with |
this event for method chaining
# sceneInterludeEvent() → {boolean}
true if this event should trigger a scene interlude
boolean
# sceneResume() → {RezEvent}
Sets this event to resume the previous scene from the scene stack
this event for method chaining
# sceneResumeEvent() → {boolean}
true if this event should resume the previous scene
boolean
# setParam(name, value) → {RezEvent}
Sets a single parameter on this event
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string
|
parameter name |
value |
*
|
parameter value |
this event for method chaining
# setParams(params) → {RezEvent}
Replaces the entire parameters object for this event
Parameters:
| Name | Type | Description |
|---|---|---|
params |
object
|
parameters object to set |
this event for method chaining
# shouldChangeScene() → {boolean}
true if this event should change to a new scene
boolean
# shouldInterludeScene() → {boolean}
true if this event should start a scene interlude
boolean
# shouldPlayCard() → {boolean}
true if this event should play a card
boolean
# shouldRender() → {boolean}
true if this event should trigger a view render
boolean
# shouldResumeScene() → {boolean}
true if this event should resume the previous scene
boolean
# static after(callback) → {RezEvent}
Creates a new event that runs the specified callback after being processed
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function
|
a parameterless callback the runs after processing |
a new event that will run the callback after processing
# static banner(message, optionsopt) → {RezEvent}
Creates a new event that displays an auto-dismissing full-width banner
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
message |
string
|
message to display in the banner |
||
options |
object
|
<optional> |
{} | optional config; supports |
a new event with the banner message set
# static error(message) → {RezEvent}
Creates a new event that represents an error
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
error message |
a new error event
# static flash(message) → {RezEvent}
Creates a new event that displays a flash message
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
flash message to display |
a new event with the flash message
# static modalCard(cardId, paramsopt, optionsopt) → {RezEvent}
Creates a new event that displays a card as a modal dialog
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cardId |
string
|
ID of the card to render in the modal |
||
params |
object
|
<optional> |
{} | optional params passed to the card on will_embed |
options |
object
|
<optional> |
{} | display options for the modal |
showDismiss |
boolean
|
<optional> |
true | when false, suppresses the default OK dismiss button so the card can supply its own dismiss control |
animation |
string
|
<optional> |
"scale" | entrance animation
( |
animationDuration |
number
|
<optional> |
180 | animation duration in ms |
a new event with the modal card set
# static modalMessage(message, optionsopt, optionsopt) → {RezEvent}
Creates a new event that displays a modal dialog
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
message |
string
|
modal body message |
||
options |
object
|
<optional> |
{} | optional config; supports |
options |
object
|
<optional> |
{} | optional config; supports |
a new event with the modal message set
# static playCard(cardId) → {RezEvent}
Creates a new event that plays the specified card
Parameters:
| Name | Type | Description |
|---|---|---|
cardId |
string
|
ID of the card to play |
a new event that plays the specified card
# static queueEvent(eventName, paramsopt, optsopt) → {RezEvent}
Creates a new event that queues a follow-up event
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
eventName |
string
|
the name of the event to raise after this response |
||
params |
object
|
<optional> |
{} | parameters passed to the queued event's handler |
opts |
object
|
<optional> |
{} | options: |
a new event that queues the specified follow-up event
# static render() → {RezEvent}
Creates a new event that triggers a view render
a new event that triggers a render
# static sceneChange(sceneId) → {RezEvent}
Creates a new event that changes to the specified scene
Parameters:
| Name | Type | Description |
|---|---|---|
sceneId |
string
|
ID of the scene to change to |
a new event that changes to the specified scene
# static sceneInterlude(sceneId) → {RezEvent}
Creates a new event that starts an interlude with the specified scene
Parameters:
| Name | Type | Description |
|---|---|---|
sceneId |
string
|
ID of the scene to interlude with |
a new event that starts an interlude
# static sceneResume() → {RezEvent}
Creates a new event that resumes the previous scene from the stack
a new event that resumes the previous scene