Whats wrong with this Verse Code? The Code is from the Epic Games AI and i have no clue about verse.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/UI }
using { /Verse.org/Colors }
using { /Fortnite.com/UI }
performance_test_device := class(creative_device):
@editable
StartButton : button_device = button_device{}
@editable
Cutscene : cinematic_sequence_device = cinematic_sequence_device{}
@editable
Music : audio_player_device = audio_player_device{}
@editable
VFXSpawners : []vfx_spawner_device = array{}
@editable
Triggers : []trigger_device = array{}
@editable
EmergencyRemote : signal_remote_manager_device = signal_remote_manager_device{}
@editable
RatingImages : []texture_block = array{} # 4 images for ratings
@editable
ProgressBar : color_block = color_block{} # UI progress bar
var TestActive : logic = false
var EmergencyStopped : logic = false
var CurrentUI : ?widget = false
OnBegin():void =
StartButton.InteractedWithEvent.Subscribe(OnTestStart)
EmergencyRemote.PrimarySignalEvent.Subscribe(OnEmergencyStop)
OnTestStart(Agent:agent):void =
if (TestActive == false):
set TestActive = true
set EmergencyStopped = false
spawn{RunTest(Agent)}
RunTest(Agent:agent):void =
# Activate all devices
Cutscene.Play()
Music.Play()
for (VFX : VFXSpawners):
VFX.Enable()
for (Trig : Triggers):
Trig.Enable()
# Show progress bar
if (Player := player[Agent], PlayerUI := GetPlayerUI[Player]):
ProgressBar.SetVisibility(widget_visibility.Visible)
PlayerUI.AddWidget(ProgressBar)
set CurrentUI = option{ProgressBar}
# Timer loop (15 seconds)
var TimeLeft : float = 15.0
loop:
if (EmergencyStopped == true):
break
if (TimeLeft <= 0.0):
break
UpdateProgressBar(TimeLeft / 15.0)
Sleep(0.1)
set TimeLeft -= 0.1
# Clean up
DeactivateAll()
if (EmergencyStopped == false):
ShowRating(Agent)
OnEmergencyStop(Agent:agent):void =
if (TestActive == true):
set EmergencyStopped = true
DeactivateAll():void =
set TestActive = false
Cutscene.Stop()
Music.Stop()
for (VFX : VFXSpawners):
VFX.Disable()
for (Trig : Triggers):
Trig.Disable()
if (UI := CurrentUI?):
UI.SetVisibility(widget_visibility.Collapsed)
set CurrentUI = false
UpdateProgressBar(Percent:float):void =
# Update progress bar width/color based on Percent
ProgressBar.SetColor(MakeColorFromSRGB(0.2, 0.6, 1.0))
# Note: SetWidth is not a valid method, so you would need to update the progress bar visually in another way
ShowRating(Agent:agent):void =
# Calculate rating index (0-3) based on performance (replace with your logic)
RatingIndex := 0
if (RatingIndex >= 0 and RatingIndex < RatingImages.Length):
if (Image := RatingImages[RatingIndex], Player := player[Agent], PlayerUI := GetPlayerUI[Player]):
Image.SetVisibility(widget_visibility.Visible)
PlayerUI.AddWidget(Image)
set CurrentUI = option{Image}