Hi,
How to solve this?
 
program walk;
procedure andar();
var
i, x, randomx, randomx2, y, randomy, randomy2 : integer;
tileinfo : tstaticcell;
begin
    randomx := random(10);
    randomx2 := random(10);
    randomy := random(10);
    randomy2 := random(10);
   
    x := getx(self) + randomx - randomx2;
    y := gety(self) + randomy - randomy2;  
    
    tileinfo := ReadStaticsXY(x, y, WorldNum);
    if tileinfo.staticcount > 0 then
    for i := Low(TileInfo.Statics)to high(TileInfo.Statics) do
    begin
    if (TileInfo.Statics[i].Tile >= 1339) and  (TileInfo.Statics[i].Tile <= 1359) and  (TileInfo.Statics[i].z = GetZ(self)) then 
    begin 
      newmovexy(x,y,true,0,false);
    end
    else
       begin
        addtosystemjournal('did not find cave floor');
        andar();  
        end 
    end;
end;
begin
 andar();
end.
i have this pascal problem, the program aren't making the loop when he is not on a cave, the script stops.. why?