Okay, i changed some stuff around. Now it looks like this.
SCAR Code:
procedure AlignToTinRocks;
begin
Status('Looking for tin rocks on minimap..');
if (FindDTM(MMTinDTM,x,y,MMX1,MMY1,MMX2,MMY2)) then
begin
Mouse(x,y,2,2,true);
Status('Found tin rocks on minimap.');
FFlag(0);
end else
begin
Status('Did not find tin rocks on minimap on first try. Trying again.');
repeat
Wait(1000+random(500));
Searches := Searches + 1;
until (FindDTM(MMTinDTM,x,y,MMX1,MMY1,MMX2,MMY2)) or (Searches = 5)
if (Searches = 5) then
begin
Status('Tried five times. Attempting FindDeformed. Expect lag..');
if (FindDeformed(x,y,MMTinRocks,MMX1,MMY1,MMX2,MMY2)) then
begin
Status('Found tin rocks on minimap!');
Mouse(x,y,2,2,true);
FFlag(0);
end else
begin
Status('Did not find tin rocks on minimap.');
Writeln('Did not find tin rocks on minimap. Account is lost.');
LogOut;
NextPlayer(False);
end;
end;
end;
end;
So, now it'll try the DTM a couple times and then use FindDeformed as a last resort. I could still use some help though. If i could alter FindDeformed to switch gametabs between each of it's searches, then RS wouldn't time out while it searched. But, when i tried doing that myself it screwed the whole thing up. Could anyone help me here?
Edit: This is what i was thinking:
SCAR Code:
function FindDeformedNew(var Xoff, Yoff: Integer; BMP, a, b, c, d: Integer):
Boolean;
var
acc, ref: Extended;
XT, YT, times, tol: Integer;
begin
ref := 0.9;
tol := 0;
for times := 1 to 50 do
GameTab(2); //Switches to Skills
GameTab(4); //Switches to Inventory
Wait(1000+random(100)); //Waits a bit
begin
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc);
if (acc >= ref) then
begin
Xoff := XT;
YOff := YT;
Result := True;
Exit;
end;
if times mod 5 = 0 then
begin
ref := ref - 0.1;
tol := tol + 10;
end;
Wait(1);
end;
end;
When i try that i get
"[Runtime Error] : Exception: Access violation at address 006A975B in module 'scar.exe'. Read of address 00000000 in line 114 in script C:\ProgramFiles\SCAR3.06\Scripts\MyPowerMiner\Walk ToMineV1.scar"
But i only get that when running it. It compiles, starts, and once it gets to that part it gives me that.
SCAR Code:
begin //112
FindDeformedBitmapToleranceIn(BMP, XT, YT, a, b, c, d, tol, 2, True, acc); //113
if (acc >= ref) then //114
begin //115