Where can I get the 'agent' to be used here?

I want to make a player who clicked a button on my main canvas to be shown the Class Selector UI, but in order to do that, I need an agent. How can I get that within this function?

HandleSelectedUIButton(Message : widget_message) : void =
        if (PlayerUI := GetPlayerUI[Message.Player], MyUI := MaybeMyUIPerPlayer[Message.Player]?, SelectedButton := text_button_base[Message.Source]):
            Print("Player selected {SelectedButton.GetText()}")
            PlayerUI.RemoveWidget(MyUI)
            if (set MaybeMyUIPerPlayer[Message.Player] = false) {}
            var SelectedButtonText : string = SelectedButton.GetText()
            MainLoopDevice.Stop()
            if (SelectedButtonText = "Box Fights"):
                BoxFightsClassUiDevice.Show(*Agent : agent*)

*The italicized code is where the error occurs: “Data definitions at this scope must be initialized with a value.” I am new to using Verse, any help is appreciated.

A Player is also an Agent, so just pass the Player reference from the Message.
BoxFightsClassUiDevice.Show(Message.Player)

You can see in the Verse digest that the base class of a Player is an Agent:
Screenshot (90)

1 Like

as far as i can tell the Player is an agent, so you might pass Message.Player

1 Like