SRL Archive - Help and Support

locating identifyer expexted error


lardmaster

2006-10-18 20:34:05

when i try to run this, it gets an identifyer expected error, but it does not give a line number, i dont know what that means, so i cant debug it. this is a program that i am working on to "sing" songs.

program New;


var s,temp,tosend:string;
filenum,i:integer;

function getsongname(i:integer):string;
var p,j:integer;
temp2:string;

begin
for p:=1 to i do
begin
temp2:=copy(s,p,6);
if temp2= 'name: ' then
begin
for j:= p to p+20 do
begin
Result:=Result+s[j];
if (getkeycode(s[j]) = 32) or (getkeycode(s[j+1]) = 32) then break;
end
end
end;

begin
filenum:=openfile('D:\Program Files\SCAR 2.03\Chatlog.txt',False);
readfilestring(filenum,s,filesize(filenum));
writeln(inttostr(length(s)));

for i:=1 to length(s) do
begin
while not (getkeycode(s[i]) = 13) do
begin
temp:=copy(s,i,1);
tosend:=tosend+temp;
i:=i+1;
end
i:=i+1;
sendkeys(tosend);
keydown(13);
keyup(13);
tosend:='';
end
writeln(getsongname(40));
end.

Dankness

2006-10-18 21:17:19

Identifyer expected means simply put, you have to many ends in your script. I suggest

1 using scripting standards to make viewing the script easyer and you will easyily see where it is

2 to actually locate your problem just comment out procedures until it compiles then uncomment them until you figure out where the problem is, All things in life can be solved in this method of deduction…


program New;

var S, Temp, ToSend : string;
Filenum , I : Integer;

function GetSongName ( I : Integer ) : string;
var p,j : Integer;
Temp2:string;
begin
for p:=1 to i do
begin
Temp2 := Copy ( s, p, 6 );
if Temp2 = 'name: ' then
for j:= p to p+20 do
begin
Result := Result + s[j];
if ( GetKeyCode(s[j]) = 32) or ( GetKeyCode(s[j+1]) = 32) then
Break;
end
end;
end;

begin
Filenum := Openfile ('D:\Program Files\SCAR 2.03\Chatlog.txt',False);
ReadFileString ( Filenum, s, FileSize ( Filenum ));
WriteLn ( Inttostr ( Length ( s )));
for i:=1 to length(s) do
begin
while not (getkeycode(s[i]) = 13) do
begin
Temp := copy ( s, i, 1);
ToSend:= ToSend + Temp;
i := i + 1;
end;
i := i + 1;
SendKeys ( ToSend );
KeyDown ( 13 );
KeyUp ( 13 );
Tosend:='';
end;
WriteLn ( GetSongName ( 40 ));
end.

masquerader

2006-10-18 22:02:59

ah, dankness, what happened to the scar tags?
the formatting is bad now

lardmaster

2006-10-19 18:29:27

thnx, i know i need to organize it, i just wasnt sure what the error ment.