I have couple of issues with this one:
When I run it I get a run-time error in line 50 of SRL.scar when it hits the line srl_FreeBitmaps
And when I run this (with bank already open) it searches, finds my rune axe which is the top left corner of the search, then reclicks on All Tab because the coords returned are messed.
Here's the output from this:
Code:
SRL Compiled in 16 msec
screen coord x: 57, y: 98
bank coord x: 0, y: 0
[Runtime Error] : Out Of Range in line 50 in script C:\Program Files\SCAR 3.15\includes\SRL/SRL.scar
Edit: Yuck! Don't ever post your message after hitting the preview button. It goes all to hell. Reposted so its readable.
SCAR Code:
program New;
{.Include SRL/SRL.scar}
const
bronze = 0;
iron = 1;
steel = 2;
black = 3;
mithril = 4;
adamant=5;
rune = 6;
dragon = 7;
none = 99;
function FindAxeInBank(BestAxeToUse: integer; TakeOut: boolean): integer;
var
MSP: TPoint;
BP: TPoint;
Axe: integer;
begin
result := none;
srl_LoadBitmaps([bmp_Axe_Bronze, bmp_Axe_Iron, bmp_Axe_Steel, bmp_Axe_Black,
bmp_Axe_Mithril, bmp_Axe_Adamant, bmp_Axe_Rune, bmp_Axe_Dragon]);
try
FixBankTab();
FixBank;
SearchBank('axe');
for Axe := BestAxeToUse downto bronze do
begin
if FindBitmapToleranceIn(srl_GetBitmap(bmp_Axe_Bronze + Axe), MSP.x, MSP.y, MSX1, MSY1, MIX1, MSY2, 10) then
begin
if (TakeOut) then
begin
writeln('screen coord x: ' + inttostr(MSP.x) + ', y: ' + intTostr(MSP.y));
BP := MSTPointToBankPoint(MSP);
writeln('bank coord x: ' + inttostr(BP.x) + ', y: ' + intTostr(bp.y));
Withdraw(BP.y, BP.x, 1);
end;
result := Axe;
exit;
end;
end;
finally
srl_FreeBitmaps;
end;
end;
begin
ClearDebug;
SetupSRL;
ActivateClient;
FindAxeInBank(rune, true);
end.