How to send data events with a payload that contains only a subset of the parameters in the format string

This question came up recently and is quite a common use case so worthy of some discussion.

Question: I have defined a named custom event in Storyboard and I want to send this event using Storyboard IO with some data payload.  I have multiple data parameters defined in the payload and format string but I don't always want to send every parameter.  Is it possible to just send a subset?

Answer: Yes it is possible. Each time an event is sent with Storyboard either through the Lua API or through the actions in Designer the event name, format string and data are specified. As long as the format string matches the data parameters provided for a given named event then each time you invoke send you can include a subset of a larger event definition.

Events are received and handled by event name so by using this technique it is possible to simplify and re-use the event handler functionality.

To illustrate this approach I made a quick video walk-through:

Video How To : Sending data Storyboard custom events with a parameter subset

0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post