SCAR Code:
{*******************************************************************************
function LoginPlayerToLob: Boolean;
By: The SRL Team
Description: Like LoginPlayer but only to the lobbyscreen.
*******************************************************************************}
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(381, 41), 6868097, 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(489, 407, 642, 424, 1) //Member's login button
else
MouseBox(314, 408, 457, 421, 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', ''];
1506: Actions := ['Your account is already logged in', 5000, 0, 'PlayerTrue', ''];
1608: Actions := ['Not a Members Account', 0, 1, 'PlayerFalse', 'Non-member'];
1610: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'PlayerFalse', ''];
1994: Actions := ['Your account has been disabled', 0, 0, 'PlayerFalse', 'Acc Disabled'];
2398: Actions := ['Found New Player Welcome', 0, 0, 'ClickExplore', ''];
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;
'ClickExplore': MouseBox(275, 335, 485, 355, 1);
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;