SRL Archive - SRL Suggestions

InPin to fast


RAM

2011-03-14 04:31:04

I added a wait in InPin,in my version to compensate for lag….

Brandon

2011-03-14 05:28:04

Hey I noticed this aswell as the one where sometimes it types the username and password in the Username box and never logs you in unless you disable it and login manually or restart the script.

i luffs yeww

2011-03-14 09:53:15

We shouldn't just be using a wait..? Do we not check to see if the numbers have moved? :x

I'll make a change and post it.

Harry

2011-03-14 09:56:53

Uh, the numbers are all client-side (until you fill all four - then it sends to the RS server). Unless your computer is lagging bad, it shouldn't have any issues. But more failsafes are always nice.

Gu3st...

2011-03-14 10:56:00

Just increase the wait.. I even commented that line so it should be easy to understand what to do if it was too fast / slow

i luffs yeww

2011-03-14 11:04:11

Why just increase the wait? :x The most logical thing to do, in my opinion, is just to do something easy like make a TPA of the first found yellow point in each box and then if that TPA has changed, the numbers have been updated. That would only add a few lines and would make it so lag doesn't matter.

Gu3st...

2011-03-14 11:18:15

From: i luffs yeww
Why just increase the wait? :x The most logical thing to do, in my opinion, is just to do something easy like make a TPA of the first found yellow point in each box and then if that TPA has changed, the numbers have been updated. That would only add a few lines and would make it so lag doesn't matter.
Sounds like a good idea :)

Daniel

2011-03-15 01:03:07

From: i luffs yeww
Why just increase the wait? :x The most logical thing to do, in my opinion, is just to do something easy like make a TPA of the first found yellow point in each box and then if that TPA has changed, the numbers have been updated. That would only add a few lines and would make it so lag doesn't matter.


Okay, and what if the numbers end up in the same position as before? I've seen it happen…

i luffs yeww

2011-03-15 01:06:11

Doesn't have a little set of four characters that change when you put in a number? Use that.

Gu3st...

2011-03-15 11:17:35

The text saying "Please click the first number" or w/e changes for each number ("second", "third", "forth"). So we can use that.

i luffs yeww

2011-03-15 15:53:10

I just haven't been on windows long enough this whole time to do this. :p A CountColor would be all you'd need.

Gu3st...

2011-03-15 17:29:51

It was a simple fix:
function InPin(Pin: string): Boolean;
var
Tx, Ty, X, Y, H, I, J, Tries, ColorCount : 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;

ColorCount := CountColorTolerance(clWhite, 150, 80, 380, 100, 10);
// Counts the "Now click the NUM_X digit.". This is used later on.

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(100);
while (CountColorTolerance(clWhite, 150, 80, 380, 100, 10) = ColorCount) do
Wait(500);

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;

E: diff:
mar 15 18:28:37 2011
@@ -115,7 +115,7 @@
*******************************************************************************}
function InPin(Pin: string): Boolean;
var
- Tx, Ty, X, Y, H, I, J, Tries : Integer;
+ Tx, Ty, X, Y, H, I, J, Tries, ColorCount : Integer;
Boxes: array of TBox;
begin
Result := False;
@@ -141,6 +141,10 @@
for I := 1 to 4 do
begin
if not PinScreen then Break;
+
+ ColorCount := CountColorTolerance(clWhite, 150, 80, 380, 100, 10);
+ // Counts the "Now click the NUM_X digit.". This is used later on.
+
GetMousePos(X, Y);
if (FindText(Tx, Ty, Pin[I], UpChars, 30, 100, 383, 319)) then
begin
@@ -166,7 +170,9 @@
end;
end;

- Wait(200+Random(100)); // Had to add a wait here because humans aren't that fast.
+ Wait(100);
+ while (CountColorTolerance(clWhite, 150, 80, 380, 100, 10) = ColorCount) do
+ Wait(500);

if BankScreen then
begin
@@ -1243,4 +1249,4 @@
end else
Writeln('Could not find the deposit box');
end;
-end;
\ No newline at end of file
+end;

Baked0420

2011-03-24 23:59:29

I just changed the wait(200+random(100)) to wait(400+random(300)), not because my computer was lagging, but it was too quick to seem human and sometime after clicking the fourth number, it'd go to click the first number again thinking the pin screen stayed open from entering the wrong pin. So the extra 200 ms helped make it not do that for me and looks more human in my opinion between clicking numbers.

Flight

2011-03-25 00:46:05

Yeah I have the same problems with this as well. I think the smartest fix for this is to get rid of the wait between inputting the different pin numbers, and instead go by the pin number displayed at the top of the screen. ("…Choose the SECOND number…") That way we know we're ready to click the next number.

Coh3n

2011-03-25 01:58:11

From: ggzz
Hey I noticed this aswell as the one where sometimes it types the username and password in the Username box and never logs you in unless you disable it and login manually or restart the script.

This was fixed the other day. :)

Also, has anyone tested Zyt3x's fix?

Flight

2011-03-25 02:15:18

I'm going to give Zyt3x's a shot soon, I'll have to simulate some lag to see if it really is a fix. I suppose loading multiple youtube videos would do the trick. :p I'll let ya know after wards how it turns out.

Coh3n

2011-03-25 02:17:08

From: Flight
I'm going to give Zyt3x's a shot soon, I'll have to simulate some lag to see if it really is a fix. I suppose loading multiple youtube videos would do the trick. :p I'll let ya know after wards how it turns out.

Lol okay great, thanks. :)

RAM

2011-03-25 02:24:21

From: Baked0420
I just changed the wait(200+random(100)) to wait(400+random(300)), not because my computer was lagging, but it was too quick to seem human and sometime after clicking the fourth number, it'd go to click the first number again thinking the pin screen stayed open from entering the wrong pin. So the extra 200 ms helped make it not do that for me and looks more human in my opinion between clicking numbers.


This has been an issue for years for me with my slower machines/bandwidth, and this has always been my quick and easy fix, but Thank You to everyone else who went above and beyond to make sure proper fail-safes were in order. :)

~RAM

Flight

2011-03-25 03:05:42

Zyt3x's worked fine for me, I'm not really sure what what the changes were that he made, and I couldn't really 'lay' on a heavy amount of lag at the time, but it worked successfully when I tried.

Gu3st...

2011-03-25 04:23:43

From: Flight
Zyt3x's worked fine for me, I'm not really sure what what the changes were that he made, and I couldn't really 'lay' on a heavy amount of lag at the time, but it worked successfully when I tried.
I added a color check to make sure that the client had updated before it clicked a number :)

Narcle

2011-03-25 05:03:41

What Zytex did was what I was thinking. I personally don't like to rely on 'waits' to continue a function. Always good to have a repeating loop of a wait to confirm the next step.

Flight

2011-03-25 08:40:40

From: Narcle
What Zytex did was what I was thinking. I personally don't like to rely on 'waits' to continue a function. Always good to have a repeating loop of a wait to confirm the next step.


From: Flight

Yeah I have the same problems with this as well. I think the smartest fix for this is to get rid of the wait between inputting the different pin numbers, and instead go by the pin number displayed at the top of the screen. ("…Choose the SECOND number…") That way we know we're ready to click the next number.


@Zyt3x: Smart :p I was gonna suggest using the OCR to grab the text at the top of the pin screen(that tells you which number order you're on), and going from there.

Gu3st...

2011-03-25 12:06:47

From: Flight
@Zyt3x: Smart :p I was gonna suggest using the OCR to grab the text at the top of the pin screen(that tells you which number order you're on), and going from there.
Yes, that would work too :)
The only reason why I didn't do that was because I though it was kind of over-doing it, as you already know what order the pin numbers will be entered, so we don't really have to rely on the OCR :)

Coh3n

2011-03-26 19:35:51

Committed. :)