am i right in thinking that this cave is like a tunnel and you enter it and then exit to another tunnel? if i am, then your best bet is this:
if(posn(o0,x,y,x,y)){ //where x,y,x,y arethe points ofa square
reposition.to(o0,x,y); //where x,y are in the exit cave
set.dir(o0,x); //x is direction: 1 for up-right, 2 for right, etc.
}