The error describes the problem. The handler function signature must match what the event expects. Like so:
OnTriggeredEvent<private>(Agent: ?agent):void=
(Note that <private>
is only allowed inside a class - watch indents.)
If you want to pass extra data to the handler, you can use a wrapper (similar code is available in the snippets section.)
(Listenable : listenable(?agent)).SubscribeAgentVoid(Out : tuple(?agent, t)->void, MyData : t where t:type) : cancelable =
Wrapper := wrapper_agentvoid(t){MyData := MyData, Out := Out}
Listenable.Subscribe(Wrapper.In)
wrapper_agentvoid(t : type) := class():
MyData : t;
Out : tuple(?agent, t) -> void
In(Agent : ?agent):void = Out(Agent, MyData)
Which you could then use like this:
TriggerCancelable : cancelable = Trigger.TriggeredEvent.SubscribeAgentVoid(OnTriggeredEvent, "Your String")
Or check this out: