I don’t know if this is a bug, so I did not mark it as such. But the following code is an example of what I have in mine.
var MyEventPerPlayer[agent]event() = map{}
(Agent : agent).FindAndSignalEvent():void=
if(ThisEvent := MyEventPerPlayer[Agent]):
ThisEvent.Signal
else:
if(set MyEventPerPlayer = ConcatenateMaps(MyEventPerPlayer, map{Agent => event()):
if(ThisEvent := MyEventPerPlayer[Agent]){ThisEvent.Signal()}
(Agent : agent).AwaitEventSignal()<suspends>:void=
if(ThisEvent := MyEventPerPlayer[Agent]):
ThisEvent.Await()
Print("Do other code here after event is signaled")
As shown above, the event awaits in one function and it is signaled in another. The issue is the event that is awaiting won’t ever get signaled for some reason…
var MyEventPerPlayer : [agent]event() = map{}
(Agent:agent).AwaitEvent()<suspends>:void=
if (Event := Agent.GetEvent[]):
Event.Await()
Print("Do other code here after event is signaled")
(Agent:agent).GetEvent()<decides><transacts>:event()=
if (Event := MyEventPerPlayer[Agent]):
Event
else:
Event:event() = event(){}
if {set MyEventPerPlayer[Agent] = Event}
Event
(Agent:agent).SignalEvent():void=
if (Event := Agent.GetEvent[]):
Event.Signal()
The issue is that AwaitEventSignal would have skipped the if block since there was no event in the map yet for that agent, and possibly because you were missing the brackets in ThisEvent.Signal for subsequent attempts.