Verse Switch State Puzzle

Hello. I am new to verse and uefn in general and I am trying to understand it. I am having trouble following this tutorial for making an escape room game.

For the Verse Switch State Puzzle: 10. Verse Switch State Puzzle | Epic Developer Community (epicgames.com)

I am stuck on the very beginning as line 19 “item_switch_puzzle” apparently has an unknown identifier. I am not sure what to do since there is only a few steps to get to where I am at so I am unsure how to progress.

Thank you for your time and help, here is my code:

using { /Fortnite.com/Devices }
using { /Verse.org/Native }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Simulation }

See Create Your Own Device Using Verse for how to create a verse device.

A Verse-authored creative device that can be placed in a level

An event handler class to handle switch interactions

This event handler is attached to events in the loop above

switch_event_handler := class():
PuzzleDevice : item_switch_puzzle
Switch : switch_device

OnSwitchPressed(InPlayer : agent) : void =
    Print("Clicked")
    PuzzleDevice.CheckSequence(InPlayer)

switch_state_puzzle := class(creative_device):

@editable
Switches : []switch_device = array{} #References the switches players can interact with

var SwitchSubscriptions : []cancelable = array{}




# Runs when the device is started in a running game
OnBegin<override>()<suspends> : void=
    
    Print("Loading Switch Puzzle")

    # Looping through each switch and adding event handlers for each switch
    for (SwitchIndex -> Switch : Switches):
        Print("Switch {SwitchIndex} added")
        Switch.TurnedOnEvent.Subscribe(switch_event_handler{PuzzleDevice := Self, Switch := Switch}.OnSwitchPressed)
        Switch.TurnedOffEvent.Subscribe(switch_event_handler{PuzzleDevice := Self, Switch := Switch}.OnSwitchPressed)

For what it’s worth, I find the same error. I haven’t looked through the whole thing, but I’m thinking that maybe that’s a mistake, and it is supposed to say “switch_state_puzzle” not “item_state_puzzle.” When you change the name, the error goes away, and creates a new error referencing a method that class is calling but hasn’t been created yet, so that makes sense.

1 Like

Hey thank you so much such an easy fix that I missed countless times!

I have been finding a lot of slight issues with these tutorials.

I still am stuck on this first section cause now CheckSequence is being marked as an unknown member. I am assuming this is a built in verse method so maybe I am missing something to import?

Thank you again!

Yes, there are some errors in the tutorials. Guess that was another one but kind of a show stopper.

The CheckSequence is a function or should I say method that you write or they have written for you. Not built-in. They want you to apparently put it in the class, the switch_event_handler.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.