# Whats wrong with this Verse Code?

**URL:** <https://forums.unrealengine.com/t/whats-wrong-with-this-verse-code/2647479>\
**Category:** Verse\
**Tags:** unreal-engine, unreal-editor-for-fortnite, fortnite-creative, UEFN, question, fortnite, verse\
**Created:** [August 20, 2025, 12:06am UTC](https://forums.unrealengine.com/t/whats-wrong-with-this-verse-code/2647479 "2025-08-20T00:06:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_bf238de613936b6f67ae937b4d1270e206e5ca9fbefae279d10f95](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/user_bf238de613936b6f67ae937b4d1270e206e5ca9fbefae279d10f95/32/1097993_2.png) [@user\_bf238de613936b6f67ae937b4d1270e206e5ca9fbefae279d10f95](https://forums.unrealengine.com/u/user_bf238de613936b6f67ae937b4d1270e206e5ca9fbefae279d10f95)\
**Post date:** [August 20, 2025, 12:06am UTC](https://forums.unrealengine.com/t/whats-wrong-with-this-verse-code/2647479/1 "2025-08-20T00:06:58Z")

</div>

Whats wrong with this Verse Code? The Code is from the Epic Games AI and i have no clue about verse.

 ![● performance_test_device_main.verse - PcTestExtreme (Workspace) - Visual Studio Code 20.08.2025 02_05_40](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/b/7fb45e95adf34b03fa845d0cf438b097ffae0921.png)

```auto
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}

```

---

<div class="post-metadata">

**Author:** ![lantram](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lantram/32/977871_2.png) [@lantram](https://forums.unrealengine.com/u/lantram)\
**Post date:** [August 20, 2025, 5:18am UTC](https://forums.unrealengine.com/t/whats-wrong-with-this-verse-code/2647479/2 "2025-08-20T05:18:42Z")

</div>

> [@user\_bf238de613936b6f67ae937b4d1270e206e5ca9fbefae279d10f95](#):
>
> ```auto
> 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}
> 
> ```

Well, for starters the equality in this line isn’t Verse:

`if (TestActive == false):`

Nor this:

`if (EmergencyStopped == true):`

Or this:

`if (EmergencyStopped == false):`

Or this one either:

`if (TestActive == true):`

And then this is not a properly defined OnBegin:

`OnBegin():void =`

And this is not spawnable due to lack of suspends:

`RunTest(Agent:agent):void =`

And then it goes downhill from there. I’m not even sure that class is complete.

I would recommend rolling up your sleeves and learning how to write Verse instead of trying to have AI do it instead - the AI will lead you down a path to nowhere.
