A good thing to remember when coding is: when you're copying the same code over and over again, there must be a simpler way
A function like this (not tested, hope you get the general idea):
function BuildGrid(maxX:int,maxY:int,numbdata:int)
For Local loopy:Int = 0 To maxY
For Local loopx:Int = 0 To maxX
ReadData numbdata
grid:Int[loopx,loopy] = numbdata
SetColor 255,255,255
'SetScale(2,2)
DrawText numbdata,loopx*GRID_SIZEX+8 + offsetx ,loopy*GRID_SIZEY+8 + offsety
SetScale(1,1)
Next
Next
end function
will half your code in size. More importantly, when you want to change anything you'll only need to do that once instead of tracing your code in every single loop you made. You can call the function like this (example):
BuildGrid(GRID_HEIGHT-1,GRID_WIDTH1-1,numbdata1)