Studio:AutoScript Messages
There are several types of messaging performed by STRIDE. These include:
Broadcast Messaging
Broadcast messaging is used to have a message owner broadcast messages. A message user will subscribe to a message for a time. The message user will receive messages until the message user's script exits or until it unsubscribes from the message. The exact process for how this is achieved is as follows:
1. A Message User calls Subscribe() to register that it is interested in receiving message events from a given message.
2. When the Message Owner calls Broadcast(), a message event is sent to all Subscribers of the message. The message event received by the Message User is enqueued to its script's event queue. The Message User may then evaluate the messages it has received by making calls to WaitForEvent().
3. When a Message User no longer wishes to receive message events from a given message, it will call Unsubscribe() to unregister its interest in receiving events.
For a broadcast message (a message whose ascript.Messages.Item().Type is "BroadcastMessage"):
- Its owner (ascript.Messages.Item().Owner) will have a Broadcast method.
- Its user object (ascript.Messages.Item().User) will have a Subscribe method and Unsubscribe method.
- These are the only methods available for this message type. Thus other message methods (e.g. Register/Unregister) will not be available.