It feels like a basic thing to be able to have a button from an array that you want to save the index number and use it within a function, but its overly complex and unorthodox (especially for a beginner like me) to make a handler and subscribe to that instead.
Would be nice to have a way to easily add parameters to events so we can pass information, without any need to setup handlers (and ideally something that a beginner can understand, verse is already hard as it is)
I understand your frustration. Im also a beginner and its hard to learn everything when there isnt much out there yet. But from my understand it has to be that way. You dont want to accidently change something else by not clearly defining exactly what you want to change, how you want to change it, and even what can change it. (Newbe so i dont even know the terminology). The one thing I keep telling myself is verse is still very new. The fact it actually runs as good as it does is pretty amazing. With time it will get better. Ive been having really rough nights of trying to get my program to execute the way i think it should, but it wont. But when you finally get it to its so rewarding.
My favorite way to do this is using Await instead of Subscribe:
OnBegin<override>()<suspends>:void=
for (Index->Switch : Switches):
spawn {AwaitSwitchTurnedOn(Switch, Index)}
AwaitSwitchTurnedOn<private>(Switch:switch_device, Index:int)<suspends>:void=
loop:
Agent:agent = Switch.TurnedOnEvent.Await()
# Do something with Agent and Index
In the example @Ep8Script showed, the Switches variable is an @editable variable containing an array of switch_device that are referenced through the Verse device in UEFN. So yeah, it works on existing devices.
I’d like to point out that this method can be more convenient and easy to use but it’s still not beginner friendly, also, it can only be triggered once per frame, whereas the Subscribe() method could be called many times on the same frame (correct me if I’m wrong)
Verse is single-threaded, so as long as you don’t call any suspending functions afterwards without spawn, it will work just as well as Subscribe with each signal running in order.