This function can be used to get the value (either a real number or a string) from any cell within the given ds_grid. If you pass invalid grid coordinates to the function, then the value returned will be undefined and an error will be shown in the output window.
ds_grid_get(index, x, y);
|index||The index of the grid.|
|x||The x position of the cell you want to find the value of.|
|y||The y position of the cell you want to find the value of.|
Real or String
var xx, yy;
xx = irandom(ds_grid_width(grid) - 1);
yy = irandom(ds_grid_height(grid) - 1);
val = ds_grid_get(grid, xx, yy)
The above code selects a random cell from the ds_grid indexed in the variable "grid" and stores its value in the variable "val".