# Import the necessary tools
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /EpicGames.com/RealTimeClock }
# Define our Vault Script
vault_script := class(verse_script):
# This is our door. We'll connect it in the editor.
Door := property(Door):
get => Door
# This is our Real Time Clock device.
Clock := property(RealTimeClock):
get => Clock
# This function runs when the game starts
OnBegin<override>()<suspends>: void =>
# We'll loop forever, checking the time every second
loop:
# Get the current time from the Real Time Clock
# The clock gives us UTC time (0-24 hours)
CurrentTime := Clock.GetTime()
# Check if the time is between 6 AM (6) and 6 PM (18)
# If it is, open the door. If not, close it.
if CurrentTime.Hour >= 6 and CurrentTime.Hour < 18:
Door.Open()
else:
Door.Close()
Verse Library
verse
01 Standalone
Checks real-time hours in a loop to automatically open or close a connected door.
verse-library/using-real-time-clock-devices-in-fornite-creative/01-standalone.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.