SCAR Code:
if(High(CheckPoints)) >= 15 then
begin
result := true;
end else
result := false;
// Fixed:
result := High(CheckPoints) >= 15;
SCAR Code:
if(FindSymbol(x, y, 'rare trees'))then
begin
for i := 0 to 10 do
begin
if(FindDtmRotated(TreesDTM, x, y, MMX1, MMY1, MMX2, MMY2, Radians(-35), Radians(35), 0.02, ReturnAngle))then
begin
writeln('Found trees via symbol and DTM');
mouse(x - 15 - random(5), y + 7 + random(5), 2, 0, true)
FFlag(0);
result := true;
Exit;
end;
end
end;
This part in your CheckForTrees function is useless, because it will never be called. You already check "if FindSymbol(x, y, 'rare trees') then" earlier, and if the symbol is found you click it and exit. If the symbol is not found earlier, it will look for it again in this part of the function, which is unnecessary.
What comes to AdjustableRadialWalk, I suggest you take a look into LinearWalk in file /core/MapWalk.scar.
SCAR Code:
Procedure ToTrees;
begin
If(not(Loggedin))then
Exit;
Writeln('Walking to trees');
Randoms;
if(FindStore)then
begin
if(not(AdjustableRadialWalk(FindWaterColor, 260, 280, 60, 4, 4, 40, true)))then
begin
writeln('failed to walk to trees');
Players[CurrentPlayer].Active := False;
LogOut; // You log out here, but you don't exit the procedure
end else
FFlag(0);
repeat // ...and you will start this loop while logged out!
if(CheckForTrees)then // <- CheckForTrees never returns True if you're logged out
break;
if(not(AdjustableRadialWalk(FindWaterColor, 255, 359, 60, 4, 4, 20, true)))then
begin // Again, you log out while you can already be logged out earlier!
writeln('failed to walk to trees');
Players[CurrentPlayer].Active := False;
LogOut;
end else
FFlag(10);
until(false) // this causes an infinite loop if the first AdjustableRadialWalk after the first FindStore fails!
end else
begin
writeln('Failed to walk to store icon');
Players[CurrentPlayer].Active := False;
LogOut;
end;
end;
Same problems that are in ToTrees are also found in ToBank! You should Exit the procedures after logging out.
-------------------------------
Nice to see new scripters, and there's always a great need for Yew cutters!
You have great potential! Be more careful when you write and check all your loops after finishing them, if they're possibly endless. Also in some functions you Exit before you free your dtms!
Fix these things and you'll be a SRL Member in no time!