Помогите найти ошибку:
for i:=1 to mapy-1 do
begin
st:=readline(map);
if getchar(st,0)<>'.' then
begin
j:=0;
a:=getchar(st,j);
while a<>'_' do
begin
buf:=buf+a;
j:=j+1;
end;
l:=trunc(stringtointeger(buf));
j:=j+1;
a:=getchar(st,j);
while (a<>';') or (a<>'.') do
begin
buf:=buf+a;
j:=j+1;
end;
r:=trunc(stringtointeger(buf));
for j:=1 to r-l+1 do
drawimage(wallstyle,l+j*20-3,i*20-3);
if a=';' then
begin
st:=copy(st,length(''+l+'_'+r+';')+1,length(st)+1);
i:=i-1;
end;
end;
end;