What's New in Director 8.5 > Using the Shockwave Multiuser Server and Xtra > Creating multiuser movies > Retrieving messages |
![]() ![]() ![]() |
Retrieving messages
Your incoming message handlers will receive the message from the Multiuser Xtra as an argument. If you chose not to use the optional parameter that invokes this functionality, use getNetMessage()
in your message callback handlers.
newMessage = gMultiuserInstance.getNetMessage()
The contents of newMessage
are a property list that looks like this:
[#errorCode: 0, #recipients: ["Bob"], #senderID: "Guest Speaker", #subject: "Chat Text", #content: "Hello. Welcome to our conversation.", #timeStamp: 66114697]
You can set up individual message handlers to be triggered by specific values in the #subject
or #sender
properties and to perform different actions based on the values of each of the properties in the incoming message.
#errorCode contains an integer that can be translated to a usable error message with getNetErrorString
.
#recipients contains a list of strings that are the names of the users the message was sent to.
#senderID contains a string that is the user name of the sender.
#subject contains a string chosen by the movie author. You can use this string to indicate what kind of data is in the message and to have the message processed by a specific message callback handler.
#content can contain whatever type of Lingo data your movie requires, including integers, floating-point numbers, strings, lists, rects, points, colors, dates, 3D vectors, 3D transforms, and the media of member
and picture of member
properties.
#timeStamp contains an integer that is the number of milliseconds since the server was launched. You can use this number to synchronize events in several instances of your movie or to determine how much time the server is using to process your messages.
Once you have created a simple message callback handler, you can add additional Lingo to use the contents of the message to do specific things in your movie. For instance, you can use the data to set the location of sprites, add new images to the Stage, display chat text, update catalog information, or keep a running score in a game.
The Multiuser Xtra checks the network for incoming messages during idle time. Some complex movies may not allow enough idle time to retrieve all the incoming messages that the movie is receiving. This is often the case in movies that use go to the frame
Lingo. You can determine how many messages have arrived but have not yet been processed by using the getNumberWaitingNetMessages()
command, which will give you the number of unprocessed messages. You can then use this number to call checkNetMessages()
, which will process the number of waiting messages you specify.
![]() ![]() ![]() |