ds_grid_value_disk_exists

With this function you can check to see if a specific value (real or string) is present within a circular area of a given DS grid. If it is present the function will return true otherwise it will return false.

 

Syntax:

ds_grid_value_disk_exists(index, xm, ym, r, val);

ArgumentTypeDescription
indexDS GridThe index of the grid.
xmRealThe x position of the disk on the grid.
ymRealThe y position of the disk on the grid.
rRealThe radius of the disk on the grid.
valAnyThe value to find.

 

Returns:

Boolean

 

Example:

if (ds_grid_value_disk_exists(grid, 5, 5, 5, val))
{
    xpos = ds_grid_value_disk_x(grid, 5, 5, 5, val);
    ypos = ds_grid_value_disk_y(grid, 5, 5, 5, val);
}

The above code checks a DS grid for a specific value within a disk region. if it is found, it then stores the x and y position of the value in two variables for later use.