Send a message to another script
On this page
BASIC IN YOUR GAME
One part of a game can announce that the bell rang. A different record can decide whether it cares about that bell.
The listening record#
ON OnCustomEvent THEN
IF event.topic = "station_bell" THEN
PRINT "Heard " & event.strikes & " strikes"
END IF
END ONCheck OnCustomEvent for bell_listener and apply. In an ON block, the incoming dictionary is called event. The topic check lets this listener ignore other messages on the same event.
The sending record#
FUNCTION Run()
EMIT EVENT "OnCustomEvent" WITH {"topic": "station_bell", "strikes": 2}
RETURN TRUE
END FUNCTIONWhat you should see Running bell_sender dispatched the message. The listener printed Heard 2 strikes. Both records use the same topic text and the same field name, strikes.
