SRL Archive - SRL Bugs

Login Bug


RawringDragon

2011-06-22 16:47:38

Just a minor problem, very unlikely to happen except in certain cases:

One of my newer accounts has a 27 letter login (it's an email login). The system repeatedly gets stuck at the initial login page because it fails to delete the previous login information (ie the information from the long login) completely before putting in the new information. This occurs because I run multiple Simbas on the same login list, so it has to cycle through.

I think this is most likely because it does not select the end of the long string before repeatedly pressing backspace.

NCDS

2011-06-22 16:51:27

From: RawringDragon
Just a minor problem, very unlikely to happen except in certain cases:

One of my newer accounts has a 27 letter login (it's an email login). The system repeatedly gets stuck at the initial login page because it fails to delete the previous login information (ie the information from the long login) completely before putting in the new information. This occurs because I run multiple Simbas on the same login list, so it has to cycle through.

I think this is most likely because it does not select the end of the long string before repeatedly pressing backspace.


What you suggested is most likely what's happening. If you could watch it once though to ensure that's the case that would really be appreciated.

Will be a real simple fix if that's it though.

masterBB

2011-06-22 16:54:49

It's an endless loop ATM, needed to be fixed anyway:
 while (CountColor(LOGIN_TEXTCOLOUR, UBx1, UBy1, UBx2, UBy2) > 0) do
begin
TypeByte(VK_BACK);
Wait(50+Random(50));
end;

RawringDragon

2011-06-22 17:10:39

From: NCDS
What you suggested is most likely what's happening. If you could watch it once though to ensure that's the case that would really be appreciated.

Will be a real simple fix if that's it though.


Yes, I've watched it. It consistently only deletes say the first 10-15 characters of the long name, and then inserts the next name in sequence. At that point it's stuck for a very long time. It can be fixed manually just by disabling smart and toying around with the mouse.

Coh3n

2011-06-22 22:50:07

Moving this to Public SVN as LoginPlayer() is an SRL issue.

Right now, it should click the far right of the username box. Is your username longer than the box itself? A loop may need to be added if that's the case. Actually, the loop may not be a bad idea as a failsafe anyway.

E: An extra mouseBox() could be added to the loop masterBB posted.

masterBB

2011-06-23 04:46:50

From: Coh3n
Moving this to Public SVN as LoginPlayer() is an SRL issue.

Right now, it should click the far right of the username box. Is your username longer than the box itself? A loop may need to be added if that's the case. Actually, the loop may not be a bad idea as a failsafe anyway.

E: An extra mouseBox() could be added to the loop masterBB posted.


The point is it keeps pressing backspace, till it doesn't find a text color in the box. If the name is longer as the box, or the mouse didn't click on the end of the name, it will keep finding the color. We need to break out of the loop after an x amount of backspace presses.

Coh3n

2011-06-23 05:22:01

From: masterBB
The point is it keeps pressing backspace, till it doesn't find a text color in the box. If the name is longer as the box, or the mouse didn't click on the end of the name, it will keep finding the color. We need to break out of the loop after an x amount of backspace presses.
Yes but we don't want to start typing after breaking out if there are still letters in the box. I haven't looked at the function so it may be as simple as what you're saying.

masterBB

2011-06-23 06:00:54

not tested quick fix:
FindColors(TPA, LOGIN_TEXTCOLOUR, UBx1, UBy1, UBx2, UBy2);
repeat
if (Length(TPA) > 0) then
begin
SortTPAFrom(TPA, Point(UBx2, UBy1+(UBy2-UBy1) div 2));
Mouse(TPA[0].X + 20, TPA[0].Y, 5, 5, True);
end
else
MouseBox(UBx1, UBy1, UBx2, UBy2, 1); //Username box

tries := 0;
while (CountColor(LOGIN_TEXTCOLOUR, UBx1, UBy1, UBx2, UBy2) > 0) do
begin
Inc(tries);
TypeByte(VK_BACK);
Wait(50+Random(50));
if(tries >= RandomRange(20,24)) then
Break;
end;
until not(FindColors(TPA, LOGIN_TEXTCOLOUR, UBx1, UBy1, UBx2, UBy2));

Coh3n

2011-06-23 07:30:04

That may work. This was my version by the way, so there was a failsafe to break out of the loop (but not to repeat):

typtmp := 0;
while (CountColor(LOGIN_TEXTCOLOUR, UBx1, UBy1, UBx2, UBy2) > 0) do
begin
TypeByte(VK_BACK);
Wait(50+Random(50));
inc(typtmp);
if (typtmp > 500) then
Break;
end;
Anywho, someone care to test this login function please?

function LoginPlayerToLob: Boolean;
var
Members, RetryLogin: Boolean;
typtmp, t: integer;
Actions: TVariantArray;
T, Attempts{, I}: LongInt;
//ATPA: T2dPointArray;
TPA: TPointArray;
//B: TBox;
label
ProcStart;
begin
ActivateClient;
Wait(100);
TypeByte(vk_Escape);
Wait(500);

{Check for lobby screen already open/ already logged in}

Result := ((LobbyScreen) or (LoggedIn));
if (Result) then
Exit;

{Check for active player.}

if (not (Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
if (AllPlayersInActive) then
begin
WriteLn('All players not active!');
Exit;
end;
NextPlayer(False);
Exit;
end;

{Wait for the client to finish loading.}

T := GetSystemTime;
repeat
if (RSReady) then
Break;
if ((GetSystemTime - T) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
Wait(RandomRange(1000, 2000));
until (False);
WriteLn('Welcome to Runescape.');


{New graphics have changed box}
Case CountColor(LOGIN_TEXTCOLOUR, 198, 192, 567, 259) of
1079: MouseBox(347, 295, 414, 303, 1);
1745: MouseBox(347, 305, 414, 312, 1); // "Available graphics options have been changed..."
1801: MouseBox(347, 305, 414, 312, 1); // "There was a problem with your current graphics settings..."
end;

{Click less info if needed.}
{
if (not (SimilarColors(GetColor(382, 11), 14285562, 20))) then //Runescae sword green bead
begin
MouseBox(212, 479, 550, 495, 1); //Less info button
Wait(RandomRange(1000, 2000));
end;
}
{Click Members/free.}

Members := Players[CurrentPlayer].Member;
if (Length(Players[CurrentPlayer].WorldInfo) > 0) then
Members := Players[CurrentPlayer].WorldInfo[0];

ProcStart:

{if (Members) then
I := 1;

if (GetColor(248, 359) <> 1381653) then //Black outline on forgotten pwd button.
begin
FindColors(TPA, 9291999, 10, 370, 675, 475);
ATPA := SplitTPA(TPA, 4);
if (Length(ATPA) > 2) then
begin
if (I = 1) then
I := 0
else
I := 1;
B := GetTPABounds(ATPA[1 + I]); //If demo mode is still up
end
else
if (Length(ATPA) = 2) then
B := GetTPABounds(ATPA[0 + I]) //When there's no demo mode
else
B := IntToBox(210, 424, 367, 446);

with B do
MouseBox(X1 + 20, Y1 + 10, X2 - 20, Y2 + 8, 1);

T := GetSystemTime; //Black outline on forgotten pwd button.
while ((GetSystemTime - T < 3000) and (GetColor(248, 359) <> 1381653)) do
Wait(RandomRange(100, 200));

end; }

{Type in username}
t := (getSystemTime + (60000 * 2));
FindColors(TPA, LOGIN_TEXTCOLOUR, UBX1, UBY1, UBX2, UBY2);
repeat
if (Length(TPA) > 0) then
begin
SortTPAFrom(TPA, Point(UBX2, UBY1 + (UBY2 - UBY1) div 2));
Mouse(TPA[0].X + 20, TPA[0].Y, 5, 5, True);
end else
MouseBox(UBX1, UBY1, UBX2, UBY2, 1);

typtmp := 0;
while (CountColor(LOGIN_TEXTCOLOUR, UBX1, UBY1, UBX2, UBY2) > 0) do
begin
Inc(typtmp);
TypeByte(VK_BACK);
Wait(50+Random(50));
if (typtmp >= RandomRange(20, 24)) then
Break;
end;
until(not FindColors(TPA, LOGIN_TEXTCOLOUR, UBX1, UBY1, UBX2, UBY2) or (getSystemTime > t));

Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100 + Random(50));

{Type in password}
t := (getSystemTime + (60000 * 2));
FindColors(TPA, LOGIN_TEXTCOLOUR, PBX1, PBY1, PBX2, PBY2);
repeat
if (Length(TPA) > 0) then
begin
SortTPAFrom(TPA, Point(PBX2, PBY1 + (PBY2 - PBY1) div 2));
Mouse(TPA[0].X + 20, TPA[0].Y, 5, 5, True);
end else
MouseBox(PBX1, PBY1, PBX2, PBY2, 1);

typtmp := 0;
while (CountColor(LOGIN_TEXTCOLOUR, PBX1, PBY1, PBX2, PBY2) > 0) do
begin
Inc(typtmp);
TypeByte(VK_BACK);
Wait(50+Random(50));
if (typtmp >= RandomRange(20, 24)) then
Break;
end;
until(not FindColors(TPA, LOGIN_TEXTCOLOUR, PBX1, PBY1, PBX2, PBY2) or (getSystemTime > t));

Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(100 + Random(50));
Wait(500 + Random(300));

{Check responses}

T := GetSystemTime;
repeat

SetLength(Actions, 0);

if ((GetSystemTime - T) > 60000) then
Actions := ['One minute has passed...', 0, 5, 'PlayerFalse', 'Login Failed']
else
case (CountColor(LOGIN_TEXTCOLOUR, 260, 140, 510, 400)) of //text colour points
// WriteLn Error Wait for Retrys Action Player[CurrentPlayer].Loc
763, 2348, 2299: Actions := ['Invalid Username / Password', 0, 2, 'PlayerFalse', 'Wrong User/Pass'];
1088: Actions := ['Your account has been disabled', 0, 0, 'PlayerFalse', 'Acc Disabled'];
951: Actions := ['Your account is already logged in', 5, 0, 'PlayerTrue', 'Already logged in'];
1239: Actions := ['Not a Members Account', 0, 1, 'PlayerTrue', ''];
364: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
1057: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'PlayerFalse', 'Too many logins'];
732: Actions := ['Runescape has been updated.', 0, 0, 'Terminate', 'RS updated'];
777: Actions := ['Login limit exceeded.', 20000, 10, '', 'Waiting for login.'];
end;
{Respond}

if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
if (Actions[0] <> 'Not a Members Account') then
begin
Wait(1000 + Random(500));
TypeByte(vk_Escape);
end;
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
if (Actions[0] = 'Not a Members Account') then
begin
Players[CurrentPlayer].Member := False;
if (Length(Players[CurrentPlayer].WorldInfo) > 0) then
Players[CurrentPlayer].WorldInfo[0] := False;
MouseBox(267, 321, 496, 350, 1); //Play free game instead button
Wait(3000 + Random(2000));
Result := True;
Exit;
end;
RetryLogin := True;
Wait(2000 + Random(1000));
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'PlayerFalse': NextPlayer(False);
'PlayerTrue': NextPlayer(True);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
Result := (LobbyScreen) or (LoggedIn);
until (Result);

{Back to main screen if needed}

if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;

end;
Just realized the EXACT same code is used for the username and password. Repeated code is ugly (adds to SRL5 to-do).

Harry

2011-06-23 08:18:18

^ wat, those were my changes, no? :p

Though I do see how a long login name could still break it.

Rich

2011-06-23 11:26:14

From: Coh3n
Just realized the EXACT same code is used for the username and password. Repeated code is ugly (adds to SRL5 to-do).

function LoginPlayerToLob: Boolean;
var
Members, RetryLogin: Boolean;
typtmp, t, w: integer;
Actions: TVariantArray;
T, Attempts,{ I}: LongInt;
//ATPA: T2dPointArray;
TPA: TPointArray;
Boxes : TIntegerArray;
//B: TBox;
label
ProcStart;
begin
ActivateClient;
Wait(100);
TypeByte(vk_Escape);
Wait(500);

{Check for lobby screen already open/ already logged in}

Result := ((LobbyScreen) or (LoggedIn));
if (Result) then
Exit;

{Check for active player.}

if (not (Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
if (AllPlayersInActive) then
begin
WriteLn('All players not active!');
Exit;
end;
NextPlayer(False);
Exit;
end;

{Wait for the client to finish loading.}

T := GetSystemTime;
repeat
if (RSReady) then
Break;
if ((GetSystemTime - T) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
Wait(RandomRange(1000, 2000));
until (False);
WriteLn('Welcome to Runescape.');


{New graphics have changed box}
Case CountColor(LOGIN_TEXTCOLOUR, 198, 192, 567, 259) of
1079: MouseBox(347, 295, 414, 303, 1);
1745: MouseBox(347, 305, 414, 312, 1); // "Available graphics options have been changed..."
1801: MouseBox(347, 305, 414, 312, 1); // "There was a problem with your current graphics settings..."
end;

{Click less info if needed.}
{
if (not (SimilarColors(GetColor(382, 11), 14285562, 20))) then //Runescae sword green bead
begin
MouseBox(212, 479, 550, 495, 1); //Less info button
Wait(RandomRange(1000, 2000));
end;
}
{Click Members/free.}

Members := Players[CurrentPlayer].Member;
if (Length(Players[CurrentPlayer].WorldInfo) > 0) then
Members := Players[CurrentPlayer].WorldInfo[0];

ProcStart:

{if (Members) then
I := 1;

if (GetColor(248, 359) <> 1381653) then //Black outline on forgotten pwd button.
begin
FindColors(TPA, 9291999, 10, 370, 675, 475);
ATPA := SplitTPA(TPA, 4);
if (Length(ATPA) > 2) then
begin
if (I = 1) then
I := 0
else
I := 1;
B := GetTPABounds(ATPA[1 + I]); //If demo mode is still up
end
else
if (Length(ATPA) = 2) then
B := GetTPABounds(ATPA[0 + I]) //When there's no demo mode
else
B := IntToBox(210, 424, 367, 446);

with B do
MouseBox(X1 + 20, Y1 + 10, X2 - 20, Y2 + 8, 1);

T := GetSystemTime; //Black outline on forgotten pwd button.
while ((GetSystemTime - T < 3000) and (GetColor(248, 359) <> 1381653)) do
Wait(RandomRange(100, 200));

end; }

{Type in username and pass}
SetArrayLength(Boxes, 4);
for W:= 0 to 1 do
begin
if W = 0 then
Boxes:= [UBX1, UBY1, UBX2, UBY2]
else
Boxes:= [PBX1, PBY1, PBX2, PBY2];
t := (getSystemTime + (60000 * 2));
FindColors(TPA, LOGIN_TEXTCOLOUR, Boxes[0], Boxes[1], Boxes[2], Boxes[3]);
repeat
if (Length(TPA) > 0) then
begin
SortTPAFrom(TPA, Point(Boxes[2], Boxes[1] + (Boxes[3] - Boxes[2]) div 2));
Mouse(TPA[0].X + 20, TPA[0].Y, 5, 5, True);
end else
MouseBox(Boxes[0], Boxes[1], Boxes[2], Boxes[3], 1);

typtmp := 0;
while (CountColor(LOGIN_TEXTCOLOUR, Boxes[0], Boxes[1], Boxes[2], Boxes[3]) > 0) do
begin
Inc(typtmp);
TypeByte(VK_BACK);
Wait(50+Random(50));
if (typtmp >= RandomRange(20, 24)) then
Break;
end;
until(not FindColors(TPA, LOGIN_TEXTCOLOUR, Boxes[0], Boxes[1], Boxes[2], Boxes[3]) or (getSystemTime > t));

Wait(100 + Random(200));
if W = 0 then
begin
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
end else
TypeSend(Players[CurrentPlayer].Pass);
Wait(100 + Random(50));
end;

{Check responses}

T := GetSystemTime;
repeat

SetLength(Actions, 0);

if ((GetSystemTime - T) > 60000) then
Actions := ['One minute has passed...', 0, 5, 'PlayerFalse', 'Login Failed']
else
case (CountColor(LOGIN_TEXTCOLOUR, 260, 140, 510, 400)) of //text colour points
// WriteLn Error Wait for Retrys Action Player[CurrentPlayer].Loc
763, 2348, 2299: Actions := ['Invalid Username / Password', 0, 2, 'PlayerFalse', 'Wrong User/Pass'];
1088: Actions := ['Your account has been disabled', 0, 0, 'PlayerFalse', 'Acc Disabled'];
951: Actions := ['Your account is already logged in', 5, 0, 'PlayerTrue', 'Already logged in'];
1239: Actions := ['Not a Members Account', 0, 1, 'PlayerTrue', ''];
364: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
1057: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'PlayerFalse', 'Too many logins'];
732: Actions := ['Runescape has been updated.', 0, 0, 'Terminate', 'RS updated'];
777: Actions := ['Login limit exceeded.', 20000, 10, '', 'Waiting for login.'];
end;
{Respond}

if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
if (Actions[0] <> 'Not a Members Account') then
begin
Wait(1000 + Random(500));
TypeByte(vk_Escape);
end;
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
if (Actions[0] = 'Not a Members Account') then
begin
Players[CurrentPlayer].Member := False;
if (Length(Players[CurrentPlayer].WorldInfo) > 0) then
Players[CurrentPlayer].WorldInfo[0] := False;
MouseBox(267, 321, 496, 350, 1); //Play free game instead button
Wait(3000 + Random(2000));
Result := True;
Exit;
end;
RetryLogin := True;
Wait(2000 + Random(1000));
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'PlayerFalse': NextPlayer(False);
'PlayerTrue': NextPlayer(True);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
Result := (LobbyScreen) or (LoggedIn);
until (Result);

{Back to main screen if needed}

if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;

end;
This doesn't have the fix for the problem in the OP, but I've changed what you pointed out.

masterBB

2011-06-23 11:37:03

Where does your for loop ends?

Rich

2011-06-23 11:39:09

From: masterBB
Where does your for loop ends?

Forgot about that. Thanks and changed.

Coh3n

2011-06-23 18:54:33

From: Harry
^ wat, those were my changes, no? :p

Though I do see how a long login name could still break it.
I was pointing out what my version of SRL was, he posted a different version. Has anyone tested Rich's version? If not I'll test and commit later tonight.

Rich

2011-06-23 18:59:49

From: Coh3n
I was pointing out what my version of SRL was, he posted a different version. Has anyone tested Rich's version? If not I'll test and commit later tonight.
I haven't tested it myself, but it should work. All I've done is create an extra array and assign the points to that.

Coh3n

2011-06-23 19:04:45

Yeah but your version also includes masterBB's fix. Also, theoretically things should always work and I've learned that 95% of the time, that's not the case. :p

Coh3n

2011-06-26 08:00:14

Okay just letting you guys know I haven't forgotten about this, but I can't do it until tomorrow night. I'll also be making a couple other updates:
  • Failsafe in gameTab that sets the CTS to 1 in case the scripter didn't reset CTS 2 somewhere in their script.
  • Check if the player is logged in before entering the username/password. I just lost connection and the screen went black for a few seconds then it started entering the username/password. Looked bad. :p
  • Plus this fix. :)
So, please be patient. If someone wants to make the changes and test, that will help me greatly.

Cheers,
Coh3n

Brandon

2011-06-26 12:52:23

why not just use the delete key and backspace in a combination?

It backspaces until the cursor is at the start of the box.. then it presses delete until the colour of the text is not found.. this would mean the box is now blank.. then it starts to type the new username and password..

Good idea? Or no?

Smarter Child

2011-06-26 15:22:47

From: ggzz
why not just use the delete key and backspace in a combination?

It backspaces until the cursor is at the start of the box.. then it presses delete until the colour of the text is not found.. this would mean the box is now blank.. then it starts to type the new username and password..

Good idea? Or no?


Yeah, seems possible. :)
Although I think the dev's have it covered.;)

Yago

2011-06-26 20:15:56

From: ggzz
why not just use the delete key and backspace in a combination?

It backspaces until the cursor is at the start of the box.. then it presses delete until the colour of the text is not found.. this would mean the box is now blank.. then it starts to type the new username and password..

Good idea? Or no?


I actually agree with this. instead of backspacing, use delete. This solves big names problems and clicking the right half of the user/pass fields to remove and username or password.

Smarter Child

2011-06-26 21:16:59

From: Yago
I actually agree with this. instead of backspacing, use delete. This solves big names problems and clicking the right half of the user/pass fields to remove and username or password.


Using both back space and delete would probably fix this completely.

Coh3n

2011-06-27 23:54:32

Used Rich's fix (which used masterBB's fix) plus fixed a bug where it wouldn't click inside the username box if the name was too long. The delete button idea didn't work like I thought (nothing was being deleted, and I couldn't be bothered to figure out why at the moment), so I just used what we already had and it works just fine.
From: SVN Log

Login fix for long emails/usernames; combined the username/password typing.