Gu3st...
2011-02-23 16:52:48
The old one was poorly written, outdated (boxes were off by some pixels) and JaGeX has updated they're pin screens to update faster (Meaning the current InPin is rather slow).
And this new version doesn't move the mouse in-between the clicks.
And this new version doesn't move the mouse in-between the clicks.
function ClosePinScreen: Boolean;
var
Timer : Integer;
begin
Result := False;
Timer := GetSystemTime + 10000;
while PinScreen do
begin
if Timer > GetSystemTime then
Break;
MouseBox(332, 258, 489, 281, 1);
Wait(500);
end;
Result := not PinScreen;
end;
function InPin(Pin: string): Boolean;
var
Tx, Ty, X, Y, H, I, J, Tries : Integer;
Boxes: array of TBox;
begin
Result := False;
if not PinScreen then Exit;
if (GetNumbers(Pin) <> Pin) then
begin
srl_Warn('InPin', '''' + Pin + ''' is not a valid Pin', warn_AllVersions);
Exit;
end;
if (Length(Pin) <> 4) then
begin
srl_Warn('InPin', 'Pin must be 4 digits long', warn_AllVersions);
Exit;
end;
Boxes := [IntToBox(37, 107, 100, 170), IntToBox(127, 107, 190, 170), IntToBox(217, 107, 280, 170), IntToBox(307, 107, 370, 170),
IntToBox(37, 179, 100, 242), IntToBox(127, 179, 190, 242), IntToBox(217, 179, 280, 242),
IntToBox(37, 251, 100, 314), IntToBox(127, 251, 190, 314), IntToBox(217, 251, 280, 314)];
while PinScreen do
begin
for I := 1 to 4 do
begin
if not PinScreen then Break;
GetMousePos(X, Y);
if (FindText(Tx, Ty, Pin[I], UpChars, 30, 100, 383, 319)) then
begin
H := High(Boxes);
for J := 0 to H do
if IntInBox(Tx, Ty, Boxes[J]) then
begin
with Boxes[J] do
if PinScreen then
MouseBox(x1, y1, x2, y2, 1);
Break;
end;
end else
begin
H := High(Boxes);
for J := 0 to H do
if IntInBox(X, Y, Boxes[J]) then
begin
with Boxes[J] do
if PinScreen then
MouseBox(x1, y1, x2, y2, 1);
Break;
end;
end;
Wait(200+Random(100)); // Had to add a wait here because humans aren't that fast.
if BankScreen then
begin
Result := True;
Exit;
end;
end;
WaitFunc(@BankScreen, 50, 300);
ClickContinue(True, True);
while not FindColor(Tx, Ty, 0, 7, 460, 69, 474) do
begin
Wait(500);
if not LoggedIn then
Exit;
end;
Inc(Tries);
if Tries > 2 then
begin
srl_Warn('InPin', '''' + Pin + ''' is not the correct Pin', warn_AllVersions);
ClosePinScreen;
Exit;
end;
end;
Result := BankScreen;
end;