
Originally Posted by
nero_dante
Thanks for the camel, I got it to work... and I tried implementing it into my script, but now I'm getting another error
Simba Code:
procedure ClimbOverLowWall();
var
LowWall: Tbox;
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 12163981, mainScreen.getBounds(), 6, colorSetting(8, 0.10, 0.86));
if length(TPA) < 1 then
exit;
ATPA := TPA.toATPA(50, 70);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['limb-over'], 500) then
fastClick(MOUSE_LEFT);
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
else begin //getting error here
writeLn('Searching again');
LowWall :=intTobox(245, 238, 257, 276);
mouseBox(LowWall, MOUSE_MOVE);
wait(200);
if isMouseOverText(['limb-over Obstacle']) then
fastClick(MOUSE_LEFT)
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
else begin
writeLn('Could not find');
terminateScript();
end;
end;
end;
end;
This is the error I'm getting
'Error: Found unexpected token "else", expected "End" at line 100
Compiling failed.'
It's because you're using the if/else statement improperly.
If/then will execute ONLY the line immediately below it if the statement is true. For example:
Simba Code:
if True then
writeln('Look it''s true')
else
writeln('Look it''s false');
But what you've got written is
Simba Code:
if True then
writeln('It''s true');
clickStuff();
doOtherStuff();
else
writeln('It''s false');
Simba doesn't know why you have an else because there's no if statement above it (that it sees). You also have to note that if you're doing an if/else statement, the line above the else should not have a semicolon. To do what you want, you need to put the code inside a begin/end.
So your script should look like this: (Assuming I guessed where you were trying to go with this)
Simba Code:
procedure ClimbOverLowWall();
var
LowWall: Tbox;
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
findColorsSpiralTolerance(x, y, TPA, 12163981, mainScreen.getBounds(), 6, colorSetting(8, 0.10, 0.86));
if length(TPA) < 1 then
exit;
ATPA := TPA.toATPA(50, 70);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['limb-over'], 500) then
begin //Add begin here
fastClick(MOUSE_LEFT);
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
end else //end goes here
begin
writeLn('Searching again');
LowWall :=intTobox(245, 238, 257, 276);
mouseBox(LowWall, MOUSE_MOVE);
wait(200);
if isMouseOverText(['limb-over Obstacle']) then
begin // another begin here
fastClick(MOUSE_LEFT)
WriteLn('Climbing over Low Wall');
wait(gaussRangeInt(4800,5200));
end else //another end here
begin
writeLn('Could not find');
terminateScript();
end;
end;
end;
end;
Also your standards are a little wonky which makes it harder for folks like me to read your code and notice what went wrong. I fixed them up for you in my code above.
Edit: Damnit @hoodz; ninja'd me