ds_grid_get(index, x, y);
Argument | Description |
---|---|
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. |
Returns: Real or String
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 0.
var xx, yy;
xx = irandom(ds_grid_width(grid) - 1);
yy = irandom(ds_grid_height(grid) - 1);
val = ds_grid_get(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".