Hello! I wanted to confirm that this pattern I’m using in Verse is the expected pattern to use for events and to see if there are any other people using events differently.
I’m used to be able to create events more similar to the way most of the “subscribable” events are on the Epic created Verse classes. You subscribe to an event and when it fires, your function gets called. However, I couldn’t find an example of creating and triggering your own “subscribable”. The docs make it sound like your class needs to implement “signalable” and “subscribable” but it’s unclear to me how you create specific events that way. However, I did find the “event” object and I have started to use that.
The event object looks to be created for async contexts and the pattern I started using is as follows
HandlerFunction<private>()<suspends> : void =
loop:
EventPayload : event_payload = AnotherObject.CustomEvent.Await()
Logger.Print("CustomEvent Tirggered")
# DO something with the payload
OnBegin<override>()<suspends>:void=
#init logic
spawn:
HandlerFunction()
If I need multiple event handlers in the class, I spawn them each individually. This doesn’t feel quite right but it works, so I wanted to see how others are using events and if anyone has figured out the “subscribable” pattern.
Thanks!