ds_grid_read

Reads the grid data structure from a string.

Syntax:

GML Code Example

ds_grid_read(index, string [, legacy]);


Argument Description
index The index of the grid to read.
string The string to read into the ds_grid.
legacy (optional) Can be either true or false or omitted completely.


Returns: N/A


Description

This function can be used to convert a string which has been created previously by the function ds_grid_write() back into a ds_grid. The ds_grid must have been created previously (see the example below). Note that if the data structure was created with previous versions of GameMaker you should add the optional argument "legacy", setting it to true as the string format has changed with this version.


Example:

GML Code Example

grid = ds_grid_create(room_width div 32, room_height div 32);
 ini_open("Save.ini");
 ds_grid_read(grid, ini_read_string("Save", "0", ""));
 ini_close();
 

The above code creates a ds_grid based on the size of the room (each 32x32 square of pixels represents one grid cell) and then reads a previously saved set of grid data from an ini file into the new ds grid.


Back: DS Grids



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here