Verse Library verse

01 Device

Checks game time of day and prints a corresponding message at start.

verse-library/island-settings/01-device.verse

# This is a simple script for your island.
# It checks the current time.

using { /Fortnite.com/Devices }
using { /Verse.org/Sim }

# This is our main device.
# It runs when the game starts.
CreateIslandDevice() = class(creative_device):
    
    # This function runs once at the start.
    OnBegin<override>()<suspends>: void =
        # We get the current time from the island.
        # This is a special function built into Verse.
        current_time := GetTimeOfDay()
        
        # We check if the time is "Night".
        # This is a comparison. Like checking if a key fits a lock.
        if current_time == TimeOfDay::Night:
            # If it is night, we print a message.
            Print("Good evening! The sun is down.")
        else:
            # If it is not night, it must be day!
            Print("Good morning! The sun is up.")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in