Code:
program new;
{$i SRL\osr.simba}
const
MSX1 = 400;
MSY1 = 200;
MSX2 = 675;
MSY2 = 500;
var
x, y:integer;
function rsps_getUpText(text: string): boolean;
var
yellowTPA: tpointarray;
yellowATPA: t2dpointarray;
upText: string;
begin
FindColorsTolerance(yellowTPA, 65535, 0, 0, 350, 200, 0);
if (length(yellowTPA) > 1) then
yellowATPA := splitTPAEx(yellowTPA, 1, 10);
sortATPAFromFirstPointX(yellowATPA, point(0, 0));
upText:= getTextATPA(yellowATPA, 5, 'UpChars07');
if (upText = text) then
begin
result := true;
end else
result := false;
end;
function IsWalking(): boolean;
var
BMPA, BMPB, w, h: Int32;
begin
try
BMPA := BitmapFromClient(MSX1, MSY1, MSX2, MSY2);
Wait(69);
BMPB := BitmapFromClient(MSX1, MSY1, MSX2, MSY2);
GetBitmapSize(BMPA, w, h);
Result := (CalculatePixelShift(BMPA, BMPB, [0, 0, w-1, h-1]) > 50000);
finally
if BitmapExists(BMPA) then FreeBitmap(BMPA);
if BitmapExists(BMPB) then FreeBitmap(BMPB);
end;
end;
function findPikachu: boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
CTS, clicked, I: Integer;
begin
CTS := GetToleranceSpeed();
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.03, 1.11);
FindColorsSpiralTolerance(400, 200, TPA, 4701409, 0, 0, MSX2, 500, 12);
SetColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 30, 30);
SortATPASize(TPAA, True);
WriteLn(TPAA);
For I := 0 To High(TPAA) do
If (GetArraylength(TPAA[i]) > 100) Then
begin
MiddleTPAEx(TPAA[i], x, y);
MoveMouse(X, Y);
writeln(TPAA[i]);
Wait(250);
If (rsps_getUpText('Pikachu')) Then
begin
while IsWalking() do Wait(500);
ClickMouse(x, y, mouse_left);
Wait(4800);
exit;
end;
end;
result := true;
end;
begin
repeat
findPikachu;
until(false);
end.
I have written the above script by plagiarising different scripts and putting them together.