# This is our main script. It runs when the game starts. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /Verse.org/Native } # We define our device class. performance_checker_device := class(creative_device): # We define a function called MeasurePerformance. # A function is a list of steps we can reuse. MeasurePerformance(): void = # Start a stopwatch. # This is like saying "Go!" at the start of a race. StartTime : float = GetSimulationElapsedTime() # Do a small task. # Let's pretend this is a complex game calculation. # We will just count up many times. var Accumulator : int = 0 loop: # This loop runs 1000 times. # It takes a little time to finish. set Accumulator += 1 if (Accumulator >= 1000): break # Stop the stopwatch. # This is like saying "Stop!" at the end of the race. EndTime : float = GetSimulationElapsedTime() # Calculate the difference. # This is how long the task took. Duration : float = EndTime - StartTime # Print the result to the screen. # This is like showing the race time. Print("Task took {Duration} seconds.") # Check if it was fast or slow. # If it took less than 0.1 seconds, it is smooth. if (Duration < 0.1): Print("Result: Smooth Performance!") else: # If it took longer, it is slow. Print("Result: Slow Performance!") # This runs when the island starts. OnBegin(): void = # Call our function to test performance. MeasurePerformance()