I don't understand why their separate functions. You can make it check the whole screen with for/next loops.
This isn't the code above but it's a whole example of what I think you're trying to do (making a tile map and editing it using the mouse to select the tiles). If the remarks are confusing just let me know and I'll try to explain it better.
` Set the screen size and sync rate
set display mode 640,480,32
sync rate 0
sync on
` Dimensionalize the map
dim Map(500,500)
` Load the tile bitmap
load bitmap "zelda.bmp",1
` Get the Tiles
x=1:y=1
for t=1 to 20
get image t,x,y,x+16,y+16,1
inc x,17
next t
` Change current bitmap to main screen
set current bitmap 0
` Make a random map
x=0:y=0
for t1=0 to 500
for t2=0 to 500
a=rnd(9)+1
b=rnd(60)
if b=60
a=rnd(9)+11
endif
Map(t1,t2)=a
inc x,16
next t1
x=0
inc y,16
next t2
` Main Loop
x=0:y=0
do
` Call the showmap function
ShowMap(x,y)
` Scroll map up
if upkey()>0
if y-1>0
dec y
endif
endif
` Scroll map down
if downkey()>0
if y+1<501-29
inc y
endif
endif
` Scroll map left
if leftkey()>0
if x-1>0
dec x
endif
endif
` Scroll map right
if rightkey()>0
if x+1<501-39
inc x
endif
endif
` Look at each visible tile
bx=0:by=0
` Starting y coordinate to +29 tiles
for t1=y to y+29
` Starting x coordinate to +39 tiles
for t2=x to x+39
` Check the mouse coordinates
if mousex()=>bx and mousey()=>by and mousex()<=bx+16 and mousey()<=by+16
` Make a box on the current tile selected
box bx,by,bx+16,by+16
` Check for keypresses (sends current x and y
` coordinates on the map)
CheckKeys(t2,t1)
endif
inc bx,16
next t2
bx=0
inc by,16
next t1
sync
loop
` Show the map Starting at map x coordinate y coordinate
function ShowMap(mx,my)
` Start placing tiles in the upper left corner of screen
x=0:y=0
for t1=my to my+29
for t2=mx to mx+39
` Paste tile on the screen
paste image Map(t2,t1),x,y
inc x,16
next t2
x=0
inc y,16
next t1
endfunction
` Edit the map
function CheckKeys(x,y)
` Delete tile (delete key) (blank green tile)
if keystate(211)
Map(x,y)=1
endif
` Place grass tile (1 key)
if keystate(2)
Map(x,y)=10
endif
` Place plant (2 key)
if keystate(3)
Map(x,y)=15
endif
` Place chest (3 key)
if keystate(4)
Map(x,y)=11
endif
` Place rock (4 key)
if keystate(5)
Map(x,y)=13
endif
endfunction