# This is a simple script for a button and a wall
# 1. Define our devices
# We create "slots" for our devices.
# Think of these as empty boxes waiting for devices.
device Button: ButtonDevice = device()
device Wall: PropMoverDevice = device()
# 2. The main function
# This is the brain of our script.
# It runs when the game starts.
@main
function OnGameStart(): void =
# 3. Connect the devices
# We tell the script which device is which.
# In UEFN, you will patch these in the editor.
Button = Patch[ButtonDevice]("MyButton")
Wall = Patch[PropMoverDevice]("MyWall")
# 4. Listen for an event
# We wait for the button to be pressed.
# This is called an "Event".
Button.Pressed += func():
# 5. Do something!
# When the button is pressed, change the wall.
Wall.SetColor(Color.GREEN)
Verse Library
verse
01 Fragment
Demonstrates patching devices and binding press events to change prop colors.
verse-library/device/01-fragment.verse