SCAR Code:
{*******************************************************************************
procedure LoginPlayer;
<<<<<<< .mine
By: WT-Fakawi / Raymond / Fixed By NaumanAkhlaQ
=======
By: SRL Developers
>>>>>>> .r18
Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
*******************************************************************************}
procedure LoginPlayer;
<<<<<<< .mine //< - Line 314!
Label Check;
Var
TriesXX : Integer;
Options : TStringArray;
Actions : TVariantArray;
=======
var
Tx, Ty, Mark, Attempts: Integer;
Actions: TVariantArray;
RetryLogin: Boolean;
label
ProcStart;
>>>>>>> .r18
I : Integer;
OneActive : Boolean;
LastPlayer : Integer;
begin
<<<<<<< .mine
Result := False;
OneActive := False;
if LoggedIn = False then
begin;
if (not (Players[CurrentPlayer].Active)) then
begin;
WriteLn('Current player is not Active...');
Repeat
For I := 0 to HowManyPlayers - 1 do
if players[i].Active = true then
OneActive := True;
if OneActive = True then
Break;
Wait(60000);
until false
=======
ActivateClient;
Wait(500);
LoginScreenMusic(True);
if (not(GraphicsSet)) then
begin
SetAutoingDefaults;
GraphicsSet := True;
end;
ProcStart:
if (GetColor(212, 327) = 238301) then //At Click To Play screen
begin
Wait(1000 + Random(3000));
MouseBox(227, 337, 555, 364, 1);
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end else
if (not(GetColor(520, 135) = 4038981)) and (not(LoggedIn)) then //Wait for RS to load
begin
while (not(GetColor(520, 135) = 4038981)) do
Wait(100);
WriteLn('Welcome to Runescape.');
LoginPlayer;
end else
if (not(LoggedIn)) then
begin
if (not(Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
NextPlayer(False);
Exit;
>>>>>>> .r18
<<<<<<< .mine
end
else
Begin
MouseBox(337, 162, 425, 177, 1);
Repeat
Wait(100+Random(200));
Until(GetColor(364, 260) = 6063521);
MMouse(364, 260, 14, 4);
TypeSend(Players[CurrentPlayer].Name);
=======
end;
Wait(900 + random(60));
while (not(FindColor(Tx, Ty, 12509695, 288, 181, 475, 221))) do //Click 'Log In' on main menu
begin
MouseBox(354, 163, 408, 179, 1);
>>>>>>> .r18
<<<<<<< .mine
MMouse(374, 327, 15, 5);
TypeSend(Players[CurrentPlayer].Pass);
Begin
MouseBox(342, 356, 408, 374, 1);
Repeat
Wait(300+Random(400));
TriesXX := TriesXX + 1;
Until(GetColor(11, 25) = 24577) Or (TriesXX > 60);
If TriesXX > 60 Then Goto Check
=======
Wait(100 + Random(100));
end;
MouseBox(315, 255, 447, 264, 1); //Type Username
while (CountColor(7750, 311, 252, 452, 267) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100+random(50));
MouseBox(315, 323, 447, 333, 1); //Type Password
while (CountColor(7750, 311, 320, 452, 335) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(500 + Random(300));
if (not(FindTextTPA(12509695, 0, 288, 181, 475, 221, 'login', StatChars, Nothing))) then //If 'enter' from typesend didn't log us in
begin
MouseBox(355, 359, 403, 372, 1); //Click 'login' login screen
Wait(250 + random(100));
end;
MarkTime(Mark);
repeat
SetLength(Actions, 0);
if (TimeFromMark(Mark) > 60000) then
Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
else
case (CountColor(12509695, 288, 181, 475, 221)) of //Number of text colour points
// Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
598: Actions := ['Invalid Username \ Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
787: Actions := ['You need a members account for this world.', 0, 0, 'NextPlayer', 'Non-member'];
408: Actions := ['World is full.', 5000, -1, 'Terminate', ''];
623: Actions := ['Your account is already logged in', 60000, 2, 'NextPlayer', ''];
555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
//10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
//11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected']; // Login server rejected session.
end;
if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
RetryLogin := True;
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'NextPlayer': NextPlayer(False);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
until(GetColor(212, 327) = 238301);
if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;
if (GetColor(212, 327) = 238301) then
begin
Wait(1000 + Random(2000));
MouseBox(227, 337, 555, 364, 1);
end;
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;
if (LoggedIn) then
begin
if (not(FindTextTpa(0, 0, 7, 457, 137, 475, Capitalize(Players[CurrentPlayer].Name), SmallChars, Nothing))) then //Double check if logged in player is what we think it is
begin
WriteLn('Logged In Player is not in Players array.');
LogOut;
Wait(1000 + Random(1000));
LoginPlayer;
Exit;
end;
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
if Length(Players[CurrentPlayer].NickTPA) < 2 then
begin;
Writeln('Creating the NickTPA.');
if Players[CurrentPlayer].Nick <> '' then
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
>>>>>>> .r18
else
Wait(2000+Random(3000));
Mouse(377, 352, 100, 10, True);
Wait(2000+Random(3000));
WriteLn('Sucessfully LoggedIn!');
end;
end;
<<<<<<< .mine
Check : Options := ['nter your','already','nvalid','excee','full','offl','rror','ontact','reject','reload',
'updat','disabled','member','incorrect'];
For I := 0 to High(Options) do
If FindTextTpa(12509695, 10, 279, 182, 482, 222, Options[i], StatChars, Nothing) Then
begin;
OneActive := True;
Break;
end;
If OneActive Then
Begin
SetLength(Actions,2);
Case Options[i] of
'reload' : begin; //Runescape updated
WriteLn('ERROR. RuneScape has been updated. Script Terminated.');
Terminatescript;
end;
'disabled' : begin; //Your account has been disabled..
WriteLn('Your account has been disabled');
Players[CurrentPlayer].loc := 'DISABLED';
NextPlayer(False);
Exit;
end;
'member' : begin; // You need a Members account...
WriteLn('You need a Members account...');
Players[CurrentPlayer].loc := 'Non-Member';
NextPlayer(False);
exit;
end;
'already' : begin //Account already logged in
Actions := ['Your account is already logged in',0];
LastPlayer := CurrentPlayer;
repeat
CurrentPlayer := (CurrentPlayer + 1) mod HowManyPlayers;
Wait(200);
until (Players[CurrentPlayer].Active) and (CurrentPlayer <> LastPlayer);
end;
'nvalid' : begin;// Invalid Username. 3 attempts. If fails, username/pass incorrect
Actions := ['Invalid Username \ Password',0];
Inc(SRL_Attempts);
if SRL_Attempts > 3 then
begin;
Players[CurrentPlayer].Loc := 'Login ERROR';
SRL_Attempts := 0;
Nextplayer(False);
Exit;
end;
end;
'excee' : Actions := ['Login attempts exceeded. Please wait 1 minute and try again.',60000];
'offl' : Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000)]; // Unable to connect. Login Server offline.
'nter your': Actions := ['Enter your username and password',0];//Login failed
'full' : Actions := ['World is full.',5000]; //World is full =]
'rror' : Actions := ['Error Connecting.',10000]; //Error, connection timed out?
'ontact' : Actions := ['Error loading your profile.',2000]; // Error loading your profile. Will attempt to re-login 5 more times.)
'reject' : Actions := ['Login server rejected session.',1000]; // Login server rejected session.
'updat' : Actions := ['The Server is being updated.',60000]; // The Server is being updated. Please wait 1 minute.
'incorrect': Actions := ['To many incorrect logins.',60000 * 5]; //Wrong logins baby.
end;
end;
If LoggedIn Then
begin
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
if Length(Players[CurrentPlayer].NickTPA) < 2 then
begin;
Writeln('Creating the NickTPA.');
if Players[CurrentPlayer].Nick <> '' then
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
else
begin;
Writeln('Nickname isnt set, taking the username instead..');
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
end;
end;
WriteFileString(TheFile, Chr(13) + 'Current player: '+ UpperCase(Players[CurrentPlayer].Name) + Chr(13)); //* Save NAME to file
end;
end;
Begin
Wait(1);
WriteLn('Logged Player In');
end;
Exit;
=======
AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
end;
>>>>>>> .r18
end;