mplay_data_read(ind)

ind = Shared Data slot to read

 

Do you remember writing data to certain slots using shared data (mplay_data_write())? Now in the other sides of the sessions the players can read the information stored in these slots. When calling the function you always need to store the return value into a variable because the function returns the value stored in the slot. However, you need to keep in mind that the shared data synchronization can be slow and should not be used for data sent each step like the x-y coordinates of an object.  You can use shared data for storing for example names, scores and all that data that isn’t important but that need to be sent.

 

Example

player1score = mplay_data_read(01);

 

The above code will store the data in the slot 01 into the variable player1score. Remember to use one slot for one kind of data for all the game, don’t think a crazy thing like using it for the player1 score and suddenly store the player2 name.

 

gml_josea Revision #1