SRL Archive - Jr. Member General Help and Discussion

Tpa


Wire

2014-07-14 12:06:42

Why doesn't this actually move the mouse to the Rough Wall. I'm following a tutorial on TPAs/CTS2 but don't quite understand it fully yet. I understand the beginning of the script is simply changing the color tolerance speed from normal to custom then back to normal. This is then saved to tmpCTS, but then what happens after this exactly? When trying to run the script, i do receive they found the wall but no action is taken. I tried changing MMouse to Mouse for the button variant but to no avail. Any help would be greatly appreciated, Wire.
procedure AlRoughWall;
var
tmpCTS, i, l, r, counter:integer;
RWallTPA:TPointArray;
begin
tmpCTS := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.24, 0.14);

FindColorsTolerance(RWallTPA, 2243404, MSX1, MSY1, MSX2, MSY2, 1);
SetColorToleranceSpeed(tmpCTS);

SetToleranceSpeed2Modifiers(0.02, 0.02);

l := High(RWallTPA)
marktime(counter);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
MMouse(RWallTPA[r].x, RWallTPA[r].y, 2, 2);
if waituptextmulti(['lim', 'oug', 'al'], randomrange(200, 300)) then
ClickMouse2(True);

Break;
if timefrommark(counter) > 3000 then
begin
writeln('We failed to find the Wall!');
Terminatescript;
end;
end;
writeln('We found the Wall');
clickmouse2(mouse_right);
end;

Element17

2014-07-16 21:11:50

Is this for RS3 or OSRS?

The Mayor

2014-07-16 21:17:28

From: Element17
Is this for RS3 or OSRS?


It's OSR

Flight

2014-07-17 07:00:11

I always find explaining functions easier in this style:


procedure AlRoughWall;
var
tmpCTS,i,l,r,
counter : Integer;
RWallTPA : TPointArray;
begin
tmpCTS := GetToleranceSpeed; // Let's remember the CTS before we adjust it

SetColorToleranceSpeed(2); // Set CTS for 2
SetToleranceSpeed2Modifiers(0.24, 0.14); // CTS2 mods (Hue & Sat)

FindColorsTolerance(RWallTPA, 2243404, MSX1, MSY1, MSX2, MSY2, 1); // Search the main screen for the color with the 'new' CTS2 settings
SetColorToleranceSpeed(tmpCTS); // Set the CTS back to the original
SetToleranceSpeed2Modifiers(0.02, 0.02); // Hue & Sat back to the default (0.02)

if length(RWallTPA) < 1 then // Length of the RWallTPA is 0 (no colors found) then exit
Exit;

sortTPAFrom(RWallTPA, point(MSCX,MSCY)); // Sort the RWallTPA from the center of the screen (player position)
marktime(counter);
for i := 0 to High(RWallTPA) do // Starting from the begining of the RWallTPA to the end of the RWallTPA do...
begin
wait(randomrange(60, 200));
MMouse(RWallTPA[i].x, RWallTPA[i].y, 2, 2); // ...Move the mouse to the current index in the RWallTPA
if waituptextmulti(['lim', 'oug', 'al'], randomrange(200, 300)) then // Found the correct uptext
begin
ClickMouse2(True);
Break; // Click mouse and 'break' from the loop (stop searching)
end;
if timefrommark(counter) > 3000 then // If we've been searching each point in the RWallTPA for more than 3 seconds then...
begin
writeln('We failed to find the Wall!');
Terminatescript;
end;
end;
end;

Also, I apologize for the super late reply. I actually started making comments on your procedure this morning then had to leave before even finishing. I was out all day.