Yes - Apart from the box command that I couldn't get to blank the previous text for some strange reason...
If you want to solve it yourself, don't let me stop you
dim MyZone_X1(10)
dim MyZone_Y1(10)
dim MyZone_X2(10)
dim MyZone_Y2(10)
dim MyZone_Active(10)
sync on
for i=0 to 10
x=rnd(630)
y=rnd(470)
MakeZone(i, x, y, x+10, y+10)
next i
Z=-1
do
` Erase previous text
if Z >= 0
ink 0,0
text 0, 0, "Mouse is in zone : " + str$(Z)
endif
Z=FindZone( mousex(), mousey() )
` Report new text
if Z >= 0
ink rgb(255,255,255),0
text 0, 0, "Mouse is in zone : " + str$(Z)
endif
sync
loop
function MakeZone(Z, x1, y1, x2, y2)
MyZone_X1(Z)=x1
MyZone_Y1(Z)=y1
MyZone_X2(Z)=x2
MyZone_Y2(Z)=y2
MyZone_Active(Z)=1
box x1, y1, x2+1, y2+1
endfunction
function DeleteZone(Z)
MyZone_Active(Z)=0
endfunction
function InZone(Z, x, y)
if MyZone_Active(Z) = 0 then exitfunction 0
if x < MyZone_X1(Z) then exitfunction 0
if x > MyZone_X2(Z) then exitfunction 0
if y < MyZone_Y1(Z) then exitfunction 0
if y > MyZone_Y2(Z) then exitfunction 0
endfunction 1
function FindZone(x, y)
for Z=0 to 10
if InZone(Z, x, y) then exitfunction Z
next Z
endfunction -1