U cant edit the functions within darkbasic itself without changing the .dll files in it. The best way of doing what you say is to use functions. for example:
NB: This will only work with DBP (i think, I didnt know bout this until I got DBP anyway so I dunno if it will work in DBC

)
function clearbox(top,left,bottom,right)
line top,left,top,right
line top,right,bottom,right
line bottom,right,bottom,left
line bottom,left,top,left
endfunction
You would put that code after you're main loop like so:
cls
do
clearbox(rnd(640),rnd(480),rnd(640),rnd(480))
sleep 100
loop
function clearbox(top,left,bottom,right)
line top,left,top,right
line top,right,bottom,right
line bottom,right,bottom,left
line bottom,left,top,left
endfunction
get the idea?
BTW, any variables within a function do not apply to the rest of the prog, ie a variable like 'x#' will not be affected by a variable called 'x#' in the function
Life is like a hot bath, the longer you're in it, the more wrinkles you get.