# This is a "Module." Think of it as the container for our logic.
# It tells the game, "Hey, I'm a script that controls devices."
using /Fortnite.com/Devices
using /Verse.org/Sim
# We define a "Struct" (a custom data type) to hold our devices.
# This is like a backpack that carries our specific devices.
struct ChaosButtonDevice is ISimContextOwner:
# These are our "Components" or "Devices" that we want to control.
# We are declaring them as variables because we might change them later.
Button: Button = Button{}
DaySequence: DaySequence = DaySequence{}
# This is the "Event" function.
# It runs when the simulation starts.
OnBegin() -> unit:
# We connect the Button's "Pressed" event to our own function.
# This is like wiring a wire from the Button to the Sky.
# When Button.Pressed fires, RunChaos() will be called.
Button.Pressed.Connect(RunChaos)
# This is the function that actually does the work.
RunChaos() -> unit:
# We access the DaySequence component.
# We set its "TimeOfDay" property to Midnight.
# This is a Variable assignment: changing the value of a box.
DaySequence.SetTimeOfDay(TimeOfDay::Midnight)
# Optional: Let's play a sound to make it feel epic.
# We'd need a SoundEffect device, but for now,
Verse Library
verse
01 Fragment
Groups devices in a struct and connects button events to change the sky time.
verse-library/set-up-the-basic-devices/01-fragment.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.