in the 2nd for loop, add
$MineArena::Mine[%i,%j]=%grid;
and refer to that when you want to get them
also, outer loop is rows and inner loop is columns, so %j would be X and %i would be Y
for detecting around, do:
function mineCheck(%x,%y)
{
if($MineArena::Mine[%x,%y].mine)
return -1;
%count=0;
for(%i=0;%i<3;%i++)
for(%j=0;%j<3;%j++)
if(%j!=1&&%x!=1)
if(isObject($MineArena::Mine[%i+%x-1,%j+%y-1]))
if($MineArena::Mine[%i+%x-1,%j+%y-1].mine)
%count++;
return count;
}
-1 if it is a mine, count of mines, otherwise