# This is a simplified representation of how the binding works internally.
# You don't need to write this for simple devices, but it helps to understand the flow.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# We define a device that listens for a button press
ButtonListener := class(creative_device):
# This is the Event we are listening for
OnButtonPressed: event(player) = event(player){}
# This is the Function we want to call when the event happens
OnBegin<override>()<suspends>:void=
# We bind our event to a function on another device
# In the editor, you do this by dragging and dropping in the Customize panel.
# In Verse, you might do:
# damage_zone_device.Activate.Bind(Self.OnButtonPressed)
OnButtonPressed.Await()
Verse Library
verse
01 Device
Declares a custom device event and suspends execution until the event triggers.
verse-library/getting-started-with-direct-event-binding-in-fortnite-creative/01-device.verse