thx. I hope this will work now.
`Create 3 box arrays
dim box1(4)
dim box2(4)
dim box3(4)
`Create the box position variables and assign a value to them
left1=100
top1=100
right1=200
bottom1=200
left2=300
top2=150
right2=400
bottom2=250
left3=200
top3=300
right3=300
bottom3=400
do
`Assign the position variable to an array
box1(1)=left1
box1(2)=top1
box1(3)=right1
box1(4)=bottom1
box2(1)=left2
box2(2)=top2
box2(3)=right2
box2(4)=bottom2
box3(1)=left3
box3(2)=top3
box3(3)=right3
box3(4)=bottom3
`Get the mouse position and create a variable for it
mX=mousex()
mY=mousey()
`Find out if a box has been clicked on and get the box variable
if mouseclick()=1
if mX>box1(1) and mX<box1(2) and mY>box1(3) and mY<box1(4)
boxid=1
endif
if mX>box2(1) and mX<box2(2) and mY>box2(3) and mY<box2(4)
boxid=2
endif
if mX>box3(1) and mX<box3(2) and mY>box3(3) and mY<box3(4)
boxid=3
endif
endif
`Assign the mouse position to the chosen box's position variables
if boxid=1
left1=mX+50
top1=mY+50
right1=mX-50
bottom1=mY-50
endif
if boxid=2
left2=mX+50
top2=mY+50
right2=mX-50
bottom2=mY-50
endif
if boxid=3
left3=mX+50
top3=mY+50
right3=mX-50
bottom3=mY-50
endif
`Draw the boxes
box box1(1),box1(2),box1(3),box1(4),rgb(255,0,0),rgb(255,0,0),rgb(0,0,255),rgb(0,0,255)
box box2(1),box2(2),box2(3),box2(4),rgb(255,0,0),rgb(255,0,0),rgb(0,0,255),rgb(0,0,255)
box box3(1),box3(2),box3(3),box3(4),rgb(255,0,0),rgb(255,0,0),rgb(0,0,255),rgb(0,0,255)
loop