# This is a Verse Script. Think of it as the "Brain" attached to a device.
# We import the necessary tools from Fortnite's library.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Native }
# This is our "Device" class. It's like a template for our specific button.
# In the Scene Graph, this script will live on the Button entity.
RevengeButton := class(creative_device):
# This is a "Variable". It's a container for data.
# Here, it holds a reference to the Button device we placed in the editor.
# We will connect this in the UEFN editor by selecting the device in the
# Verse Device's property panel.
# button_device is the real Verse type for a placeable Button device.
@editable
MyButton : button_device = button_device{}
# This holds a reference to the Timer device we placed.
# timer_device is the real Verse type for a placeable Timer device.
@editable
MyTimer : timer_device = timer_device{}
# This is a "Function". It's a set of instructions.
# The name "OnBegin" is special. It runs once when the island starts.
OnBegin<override>()<suspends> : void =
# We tell the script to listen for the Button being activated.
# InteractedWithEvent is the real listenable event on button_device.
# Subscribe registers a callback that fires every time the event occurs.
MyButton.InteractedWithEvent.Subscribe(HandlePress)
Verse Library
verse
01 Device
Subscribes to button interaction events and suspends execution to maintain listeners.
verse-library/set-up-the-devices/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.