SRL Archive - Reflection Help

Semicolon (';') expected in script


cbris

2008-08-18 19:10:02

in writing a simple script that takes advantage of reflection, i came across this error in WalkToBar when using WalkToTile.

Semicolon (';') expected in script

This is odd because the code contains all the semicolon that it should. Is there something i dont know? (PathToBar is called before WalkToBar in main loop).


function PathToBar: TPointArray;
begin
SetLength(Result, 8);
Result[0] := Point(2951, 3376); //t outside of bank
Result[1] := Point(2956, 3381); //t north of bar
Result[2] := Point(2956, 3374); //*******
Result[3] := Point(2956, 3372); //
Result[4] := Point(2956, 3371); //bar positions
Result[5] := Point(2956, 3370); //
Result[6] := Point(2957, 3373); //
Result[7] := Point(2957, 3372); //*******
end;

procedure WalkToBar;
begin
WalkToTile(PathToBar[0], 2, 0); //error on this line!
wait(500+random(500));
WalkToTile(PathToBar[2], 2, 0);
wait(500+random(500));
WalkToTile(PathToBar[2+random(5)], 0, 0);
{ case random(5) of
0: WalkToTile(PathToBar[2], 0, 0);
1: WalkToTile(PathToBar[3], 0, 0);
2: WalkToTile(PathToBar[4], 0, 0);
3: WalkToTile(PathToBar[5], 0, 0);
4: WalkToTile(PathToBar[6], 0, 0);
5: WalkToTile(PathToBar[7], 0, 0);
end;}
Wait(1000+Random(500));
end;

any help would be great.
It is probably i really easy fix. :redface:

EDIT: It appears it is something to do with PathToBar: TPointArray;. when i change the line to this, the problem goes away.

WalkToTile(Point(2951, 3376), 2, 0);

Infantry001

2008-08-18 19:20:26

Strange. I don't see anything that would lead to that error.

BUT…

Change
WalkToTile(PathToBar[2+Random(5)])
to
WalkToTile(PathToBar[2+Random(6)])

because the random function starts on 0.

Random(5) will get you anywhere from 0-4. Not enough to reach 7 ;)

EDIT: Maybe the semicolon error is actually in a different area? SCAR has been known not to exactly debug the right errors.

cbris

2008-08-18 19:23:30

thanks for the help. Ill look some more…