Studio:AutoScript Messages: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


== Broadcast Messaging ==
== Broadcast Messaging ==
Broadcast messaging is used to have a message owner broadcast messages. In the most general of cases a message user will subscribe to a message for a time. After a message user has subscribed to a message, the message will enqueue message events to the message user's script's event queue.
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. <br>
1. A Message User calls Subscribe() to register that it is interested in receiving message events from a given message. <br>
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().<br>
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().<br>
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.<br>
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.<br>


For a broadcast message (a message whose ascript.Messages.Item().Type is "BroadcastMessage"):  
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 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.
* Its user object (ascript.Messages.Item().User) will have a Subscribe method and Unsubscribe method.


These are the only methods available through this message type. Thus other message methods (e.g. Register/Unregister) will not be available.
* These are the only methods available for this message type. Thus other message methods (e.g. Register/Unregister) will not be available.


== One-Way Command Messaging ==
== One-Way Command Messaging ==

Revision as of 20:49, 9 July 2008

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.

One-Way Command Messaging

One-Way Response Messaging

Two-Way Command/Response Messaging