Code:
procedure LoginPlayer;
var
ClickHereToPlay,tx,ty,c : Integer;
begin
ClickHereToPlay := BitmapFromString(29, 2, 'z78DA7590410E80' +
'400803BF5450D6F5A8C6FEFF4926B08924841E384CA014C85F701' +
'DDC5495859B61402ADF271418AF42CC2E31CC71CB83938DB25BCC' +
'76CEC173EDB6575E33D4B4513B874CA267A5F51BD9FC6DFDC1D37' +
'E10FF5004');
if (not (LoggedIn)) then
begin
ActivateClient;
Wait(1000);
ClickOption('Cancel', 1);
ClickOption('Exist', 1);
if (ClickOption('Username', 1)) then
begin
// SendKeysSilent(Players[CurrentPlayer].Name + chr(13) + Players[CurrentPlayer].Pass)
Writeln (Players[CurrentPlayer].Name);
TypeSend(Players[CurrentPlayer].Name);
Wait(100 + Random(100));
Mouse(327, 272, 0, 0, True);
TypeSend(Players[CurrentPlayer].Pass);
Wait(100 + Random(100));
end;
ClickOption('Login', 1);
// Waiting for Connecting to Server...
MarkTime(Mark);
while FindText(tx,ty,'...', UpChars,240,200,530,240) do
begin
Wait(100);
if TimeFromMark(Mark)>20000 then break;
end;
repeat
Wait(1000);
// Enter your username and password. If all failed...
If FindText(tx,ty,'nter you', UpChars,240,200,530,240) then
begin
writeln('Enter your username and Password');
LoginPlayer;
Exit;
end;
// Invalid Username. 3 attempts. If fails, you haven't set your username/pass correct
If FindText(tx,ty,'nvalid', UpChars,240,200,530,240) then
begin
writeln('Invalid Username.');
Attempts:=Attempts + 1;
If Attempts > 3 then
begin
Players[CurrentPlayer].loc:='L/P ERROR';
NextPlayer(False);
end;
LoginPlayer;
Exit;
end;
// Login attempts exceeded. Please wait 1 minute and try again.
If FindText(tx,ty,'excee', UpChars,240,200,530,240) then
begin
writeln('Login attempts exceeded. Please wait 1 minute and try again.');
Wait(60000);
LoginPlayer;
Exit;
end;
// World is full.
If FindText(tx,ty,'full', UpChars,240,200,530,240) then
begin
writeln('World is full.');
Wait(3000);
LoginPlayer;
Exit;
end;
// Unable to connect. Login Server offline.
If FindText(tx,ty,'offl', UpChars,240,200,530,240) then
begin
writeln('Unable to connect Login Server offline.');
Wait((6000)+Random(6000));
LoginPlayer;
Exit;
end;
// Error Connecting.
If FindText(tx,ty,'rror', UpChars,240,200,530,240) then
begin
writeln('Error Connecting.');
Wait(10000);
LoginPlayer;
Exit;
end;
// Login server rejected session.
If FindText(tx,ty,'reject', UpChars,240,200,530,240) then
begin
writeln('Login server rejected session.');
Wait(1000);
LoginPlayer;
Exit;
end;
// Runescape has been updated.
If FindText(tx,ty,'cape ha', UpChars,240,200,530,240) then
begin
writeln('ERROR. RuneScape has been updated. Script Terminated.');
TerminateScript;
end;
// The Server is being updated. Please wait 1 minute.
If FindText(tx,ty,'updat', UpChars,240,200,530,240) then
begin
writeln('The Server is being updated.');
Wait(60000);
LoginPlayer;
Exit;
end;
// Your account has been disabled.
If FindText(tx,ty,'disabl', UpChars,240,200,530,240) then
begin
writeln('Your account has been disabled');
Players[CurrentPlayer].loc:='DISABLED';
NextPlayer(False);
Exit;
end;
// Welcome to RuneScape. If all failed...
If FindText(tx,ty,'elcom', UpChars,240,200,530,240) then
begin
writeln('Welcome.');
LoginPlayer;
Exit;
end;
until (FindBitmapToleranceIn(ClickHereToPlay, x, y, 345, 325, 475, 345, 20));
Wait(1000 + Random(500));
Mouse(x, y, 20, 2, True);
repeat
Wait(1000);
c := c + 1;
until (LoggedIn) or (c >= 600);
end;
if LoggedIn then
begin
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars); // Screenname
end;
FreeBitmap(ClickHereToPlay);
end;