SRL Archive - SRL Archives

Login.scar LoginPlayerToLob fix


NCDS

2010-05-13 09:25:52

Just had to update where it checked to see if "Less Info" needed to be clicked as it was returning false positives after today's update.

The MouseBox for the Login button was also changed in the update and that is now included in this fix as well.

function LoginPlayerToLob: Boolean;
var
Members, RetryLogin: Boolean;
Actions: TVariantArray;
T, Attempts: LongInt;
TPA: TPointArray;
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.');

{Click less info if needed.}

if (not (SimilarColors(GetColor(382, 11), 14285562, 15))) 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 (GetColor(248, 359) <> 1381653) then //Black outline on forgotten pwd button.
begin

if (Members) then
MouseBox(482, 420, 648, 447, 1) //Member's login button
else
MouseBox(299, 421, 463, 447, 1); //Free's login button

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}

FindColors(TPA, clWhite, 255, 216, 511, 236);
if (Length(TPA) > 0) then
begin
SortTPAFrom(TPA, Point(501, 225));
Mouse(TPA[0].X + 20, TPA[0].Y, 5, 5, True);
end
else
MouseBox(254, 216, 440, 234, 1); //Username box
while (CountColor(16777215, 255, 215, 385, 230) > 0) do
begin
TypeByte(VK_BACK);
Wait(50+Random(50));
end;
Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100 + Random(50));

{Type in password}

while (CountColor(16777215, 255, 270, 385, 285) > 0) do
begin
TypeByte(VK_BACK);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(500 + Random(300));

{Check responses}

T := GetSystemTime;
repeat

SetLength(Actions, 0);

if ((GetSystemTime - T) > 60000) then
Actions := ['One minute has passed...', 0, 0, 'PlayerFalse', 'Login Failed']
else
case (CountColor(16777215, 253, 170, 510, 290)) of //text colour points
// WriteLn Error Wait for Retrys Action Player[CurrentPlayer].Loc
949: Actions := ['Invalid Username / Password', 0, 2, 'PlayerFalse', 'Wrong User/Pass'];
1222: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
1316: Actions := ['Runescape has been updated.', 0, 0, 'Terminate', 'RS updated'];
1506: Actions := ['Your account is already logged in', 5000, 0, 'PlayerTrue', 'Already logged in'];
1608: Actions := ['Not a Members Account', 0, 1, 'PlayerTrue', ''];
1610: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'PlayerFalse', 'Too many logins'];
1994: Actions := ['Your account has been disabled', 0, 0, 'PlayerFalse', 'Acc Disabled'];
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;

Skitzo

2010-05-13 09:40:31

Thanks mate

mastaraymond

2010-05-13 09:42:11

Comitted

Sir R. M8gic1an

2010-05-13 09:44:42

lol, ray just beat me to it.

"Commit" -> File out of date -> wtf? -> show log -> raymond

~RM

mastaraymond

2010-05-13 09:47:26

From: Rasta Magician
lol, ray just beat me to it.

"Commit" -> File out of date -> wtf? -> show log -> raymond

~RM

Winnor :f:

Coh3n

2010-05-13 09:52:22

Committed the MouseBox fix also.

mastaraymond

2010-05-13 09:53:53

From: Coh3n
Committed the MouseBox fix also.

That would be you first commit to SRL, congrats! :thumbsup:

Coh3n

2010-05-13 09:54:45

From: mastaraymond
That would be you first commit to SRL, congrats! :thumbsup:

Why thank you mastaraymond! :D

NCDS

2010-05-13 09:57:00

Thanks guys

Coh3n

2010-05-13 09:57:55

From: NCDS
Thanks guys

No, thank you. ;)