Well i just can't it to work any ideas
Code:
program DDTMExample;
{.include SRL/SRL.scar}
var
DDTMTolerance : Integer;
function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 840;
dtmMainPoint.y := 415;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 6060421;
dtmMainPoint.Tolerance := DDTMTolerance;
dtmSubPoints[0].x := 840;
dtmSubPoints[0].y := 415;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 6060421;
dtmSubPoints[0].Tolerance := DDTMTolerance;
dtmSubPoints[1].x := 847;
dtmSubPoints[1].y := 415;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 6257800;
dtmSubPoints[1].Tolerance := DDTMTolerance;
dtmSubPoints[2].x := 836;
dtmSubPoints[2].y := 428;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 6258058;
dtmSubPoints[2].Tolerance := DDTMTolerance;
dtmSubPoints[3].x := 838;
dtmSubPoints[3].y := 402;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 6455437;
dtmSubPoints[3].Tolerance := DDTMTolerance;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
function WalkOutOfBank: Boolean;
var
TheDDTM, x, y : Integer;//The reason "TheDDTM" is declared as an integer is because the function SetDDTM returns an integer.
begin
if not LoggedIn then Exit;//Remember to put this at the beginning of all your functions/procedures.
SetRun(True);//This will turn your run, simple as that.
DDTMTolerance := 5;//Notice how we set the INITIAL DDTMTolerance to 5.
TheDDTM := SetDDTM;//Notice how we declare the variable "TheDDTM" as the SetDDTM function.
repeat//This is going to repeatly try and find the DDTM if it is not found the first time.
if not DTMRotated(TheDDTM, x, y, MMX1, MMY1, MMX2, MMY2) then//Notice how we use DTMRotated this time. This is because the MiniMap may not be on the same angle of which you made you DDTM. This allows it to find the DDTM, now matter which angle the MM is at.
begin//Notice in the above line (69) we used "if not...". Simply means if it doesn't find the DDTM it will do what's in this begin..end nest.
Writeln('Didn''t find DDTM, increasing tolerance...');
IncEx(DDTMTolerance, 5);//IncEx works like Inc, except it will increase by a set integer, rather than increase by only one. In this case, we increase the tolerance by 5 each time the DDTM is not found.
FreeDTM(TheDDTM);//ALWAYS remember to free the DDTM! We free it here because it will reload each time the loop repeats, so therefore, we need to free it each time the loop repeats.
TheDDTM := SetDDTM;//We set it here because it will reset everytime the loop repeats.
end else//This is to tell it what to do if it finds the DDTM.
begin
Writeln('Found Varrock road!');
Mouse(x, y, 4, 4, True);
Result := True;//Set the result to true because SCAR clicked the DDTM.
Break;//Make sure it breaks out of the loop if the DDTM is found, otherwise it will click the DDTM every time it is found until the tolerance is 50.
end;
until((DDTMTolerance >= 50) or not LoggedIn);//Notice how it will repeatedly try to find the DDTM until the tolerance is greater or equal to 50, or your account has logged out, or it the DDTM has been found.
DDTMTolerance := 5;//We do this to reset the DDTM's tolerance, incase we decide to use it again later in the script.
FreeDTM(TheDDTM);//This frees the DDTM if it is found. ALWAYS remember to free the DDTM!
end;
begin
ClearDebug;
SetupSRL;
ActivateClient;
if WalkOutOfBank then//Remember to include your function in you main loop. =P
Writeln('Walking out of the bank.')
else
Writeln('Couldn''t walk out of the bank.');
end.
Edit:
what do i need to do to find this?
SCAR Code:
function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 840;
dtmMainPoint.y := 415;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 6060421;
dtmMainPoint.Tolerance := 0;
dtmSubPoints[0].x := 840;
dtmSubPoints[0].y := 415;
dtmSubPoints[0].AreaSize := 0;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 6060421;
dtmSubPoints[0].Tolerance := 0;
dtmSubPoints[1].x := 847;
dtmSubPoints[1].y := 415;
dtmSubPoints[1].AreaSize := 0;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := 6257800;
dtmSubPoints[1].Tolerance := 0;
dtmSubPoints[2].x := 836;
dtmSubPoints[2].y := 428;
dtmSubPoints[2].AreaSize := 0;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := 6258058;
dtmSubPoints[2].Tolerance := 0;
dtmSubPoints[3].x := 838;
dtmSubPoints[3].y := 402;
dtmSubPoints[3].AreaSize := 0;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := 6455437;
dtmSubPoints[3].Tolerance := 0;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;