Log in

View Full Version : Updated Login Procedure.



Hey321
02-07-2007, 01:35 AM
Well, all credits for the original one go to WT-Fakawi. This version i find is better because it doesn't click the username or password text. It just typed name then pass then logs in. Hope you guys like it ;).



{************************************************* ******************************
procedure LoginPlayer;
By: WT-Fakawi with and update by Hey321
Description: Logs Player[CurrentPlayer] in. Is usually preceeded by NextPlayer.
************************************************** *****************************}
// * Still to implement, but have never encountered any of these:

// * Your account is already logged in.
// * Login limit exceeded.
// * Too many connections from your address."
// * Bad session id.
// * Could not complete login.
// * Please try using a different world.
// * Invalid loginserver requested
// * Malformed login packet.
// * Unexpected server response

procedure LoginPlayer;
var
ClickHereToPlay, tx, ty, CHx, CHy, c, TMPMask: Integer;
begin
ClickHereToPlay := BitmapFromString(33, 1, 'z78DA758E510E80300843' +
'AF54C0E2F6E94CB8FF9134123392693FFA41FA4A23A6F0888 443D' +
'26DC000A7DCE7F458F23EE444E721444B6A0F53D58FE44F43 65B7' +
'067D37AC3D95AADF2F50962C79');
if (not (LoggedIn)) then
begin
x := 150;
y := 173;

if (FindClient) then
FindWindowBySize(766, 504);

ActivateClient;
Wait(1000);
ClickOption('Cancel', 1);
ClickOption('Exist', 1);
begin
// SendKeysSilent(Players[CurrentPlayer].Name + chr(13) + Players[CurrentPlayer].Pass)
TypeSend(Players[CurrentPlayer].Name);
Wait(100 + Random(100));
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, 180, 530, 240) do
begin
Wait(100);
if TimeFromMark(Mark) > 20000 then break;
end;

MarkTime(Mark);
repeat
Wait(1000);

// Enter your username and password. If all failed...
if FindText(tx, ty, 'nter you', upchars, 240, 180, 530, 240) then
begin
WriteLn('Enter your username and Password');
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;
// Invalid Username. 3 attempts. If fails, you haven't set your username/pass correct
if FindText(tx, ty, 'nvalid', upchars, 240, 180, 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;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Login attempts exceeded. Please wait 1 minute and try again.
if FindText(tx, ty, 'excee', upchars, 240, 180, 530, 240) then
begin
WriteLn('Login attempts exceeded. Please wait 1 minute and try again.');
Wait(60000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// World is full.
if FindText(tx, ty, 'full', upchars, 240, 180, 530, 240) then
begin
WriteLn('World is full.');
Wait(3000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Unable to connect. Login Server offline.
if FindText(tx, ty, 'offl', upchars, 240, 180, 530, 240) then
begin
WriteLn('Unable to connect Login Server offline.');
Wait((6000) + Random(6000));
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Error Connecting.
if FindText(tx, ty, 'rror', upchars, 240, 180, 530, 240) then
begin
WriteLn('Error Connecting.');
Wait(10000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Error loading your profile. Will attempt to re-login 5 more times.)
if FindText(tx, ty, 'ontact', upchars, 240, 180, 530, 240) then
begin
WriteLn('Error loading your profile.');
Wait(2000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;
// Login server rejected session.
if FindText(tx, ty, 'reject', upchars, 240, 180, 530, 240) then
begin
WriteLn('Login server rejected session.');
Wait(1000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Runescape has been updated.
if FindText(tx, ty, 'reload', upchars, 240, 180, 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, 180, 530, 240) then
begin
WriteLn('The Server is being updated.');
Wait(60000);
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Your account has been disabled.
if FindText(tx, ty, 'disabled', upchars, 420, 180, 500, 220) then
begin
WriteLn('Your account has been disabled');
Players[CurrentPlayer].loc := 'DISABLED';
NextPlayer(False);
FreeBitmap(ClickHereToPlay);
Exit;
end;

// Waiting for Profile to be Transferred
if FindText(tx, ty, 'trans', upchars, 240, 180, 530, 240) then
begin
WriteLn('Waiting for your Profile to be Transferred');
Wait(2500);
end;

// You need a Members account...
if FindText(tx, ty, 'member', upchars, 240, 180, 530, 240) then
begin
WriteLn('Waiting for your Profile to be Transferred');
Wait(2500);
end;

// Welcome to RuneScape. If all failed...
if FindText(tx, ty, 'elcom', upchars, 240, 180, 530, 240) then
begin
WriteLn('Welcome.');
LoginPlayer;
FreeBitmap(ClickHereToPlay);
Exit;
end;

if TimeFromMark(Mark) > 180000 then
begin
WriteLn('three minutes have passed');
WriteFileString(TheFile, Chr(13) + 'THREE MINUTES HAVE PASSED!!!' +
Chr(13));
if (FindClient) then
FindWindowBySize(766, 504);
ActivateClient;
ClickOption('Cancel', 1);
ClickOption('Exist', 1);
end;

until (FindBitmapToleranceIn(ClickHereToPlay, CHx, CHy, 250, 270, 530, 390,
5)) or FindColor(CHx, CHy,723587, 555, 10, 575, 30);

Wait(1000 + Random(500));
if (FindBitmapToleranceIn(ClickHereToPlay, CHx, CHy, 250, 270, 530, 390, 5))
then
Mouse(CHx, CHy, 50, 20, True) else Writeln('Found Compass'); // Clicks randomly on the button

repeat
Wait(1000);
c := c + 1;
until (LoggedIn) or (c >= 600);

end;
FreeBitmap(tmpMask);
if LoggedIn then
begin
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
if NickNameBMP <> 0 then
FreeBitmap(NickNameBMP);
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick,
upchars); // Screenname
WriteFileString(TheFile, Chr(13) + UpperCase(Players[CurrentPlayer].Name) +
Chr(13)); //* Save NAME to file
end;
FreeBitmap(ClickHereToPlay);
FindNormalRandoms;
end;

Ejjman
02-07-2007, 02:33 AM
I like it :) Yes ++

YoHoJo
02-07-2007, 02:41 AM
That always bothered me
It clicks user name
Clicks password
clicks user name again
and then logs in
Pissed my off

Great Fix.

StK Squenc
02-07-2007, 02:47 AM
yep i love it too...good job =)

twobac
02-07-2007, 11:25 AM
Nice, maybe it could make the next SRL release.

Buckleyindahouse
02-07-2007, 11:42 AM
Yea, Nice Job.

WT-Fakawi
02-07-2007, 11:57 AM
the click on the username/password is intentional. I designed it that way, so it would never accidentally "miss" a log/pass. I found that without clicking, it sometimes messes up, and types the username and the pass in the same field, of start with pass etc.... But I will give this a try.

Hey321
02-07-2007, 12:25 PM
Thanks guys :). WT-Fakawi, i never had that problem, as type send always presses enter for me. I think in the 6 months I've used SRL, it's missed it once.

Dark_Sniper
02-07-2007, 01:59 PM
well mine missed 3 times last night :\

WT-Fakawi
02-07-2007, 02:08 PM
you can unblank this line:

// SendKeysSilent(Players[CurrentPlayer].Name + chr(13) + Players[CurrentPlayer].Pass)

It will fill in the username instantaneously. Looks nice, but I figure it is detectable.

dark_sniper: I thought it would... I have had it once like hey321, but changed it to the way it is now, since Login needs to be absolutely 100% bugfree.

pwnaz0r
02-08-2007, 11:27 PM
Uhh im gunna say go with what works :p

syberium
02-10-2007, 06:28 AM
if i just added longer waits woudent it never miss? or how exactly does it miss? it seems like if u just added a longer wait it would fix it.. but hey im prolly wrong. well hey321 awsome function i was thinking bout making one myself 2 but now i got urs =] great minds think alike : )

SubiN
02-10-2007, 08:11 AM
perfect !!!!! +++

Hey321
02-11-2007, 01:10 AM
Thanks all. In the whole time i've used this it's never missed a beat ;).

WT-Fakawi
02-11-2007, 08:25 AM
Wait. I just compared both....You mean to say you ONLY removed the:

Mouse(327, 272, 0, 0, True);

Was that worth the whole thread?

c0de
02-12-2007, 10:06 AM
Wait. I just compared both....You mean to say you ONLY removed the:

Mouse(327, 272, 0, 0, True);

Was that worth the whole thread?

Ahahaha, that made me laugh! :)

supadude
03-08-2008, 03:57 PM
Wait. I just compared both....You mean to say you ONLY removed the:

Mouse(327, 272, 0, 0, True);

Was that worth the whole thread?

Rofl funny thread :p

Harry
03-08-2008, 04:00 PM
Rofl funny thread :p

02-12-2007, 05:06 AM Please do not gravedig.