SRL Archive - Research & Development Lounge

LoginPlayer Re-written


Naum

2008-07-01 15:36:56

Just like SRL's. Instead of UpChars its statchars. I updated it.

Enjoy:

Function LoginPlayerX : boolean;
Label Check;
Var
TriesXX : Integer;
Options : TStringArray;
Actions : TVariantArray;
I : Integer;
OneActive : Boolean;
LastPlayer : Integer;

begin
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
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);
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
else
Wait(2000+Random(3000));
Mouse(377, 352, 100, 10, True);
Wait(2000+Random(3000));
WriteLn('Sucessfully LoggedIn!');
end;
end;

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;
end;

jakeyboy29

2008-07-01 15:42:40

were would i insert this?

PvH

2008-07-01 15:48:59

Replace your current login.scar with it;)
Nauman, it looks good;)
But why not do a
wait(100+random(100));
between the typesends?
Because with the new update, type acc, enter , type pass, enter = login, is possible, and looks way more legit IMO.
Also.. no randomness in waiting when a world is full or something like that:o
(yes I know, it is also like that in login.scar, but I am also surprised by that:o)
It looks good man;)

Naum

2008-07-01 15:56:07

Thanks, Typesend already has waits in it :)

PvH

2008-07-01 16:00:13

But now you don't have to click on login, you can simply press enter, and that looks way more legit IMO.

Also, why do you have mmouse in this?

MMouse(364, 260, 14, 4);
TypeSend(Players[CurrentPlayer].Name);
MMouse(374, 327, 15, 5);
TypeSend(Players[CurrentPlayer].Pass);
?
Isn't this ment to be mouse?:confused:
I might be wrong, since I'm really tired atm:p

Naum

2008-07-01 17:13:16

Your tired :p

Shady?

2008-07-01 17:37:43

From: pvh
Replace your current login.scar with it;)


I think you only have to replace your LoginPlayer function INSIDE login.scar, not the whole file… correct me if i'm wrong, i don't have such a big scripting knowledge.
Also, you'd have to rename the function to LoginPlayer, without the X at the end, in order not to have to edit any other stuff.

Waddo

2008-07-01 18:27:34

no shady you are correct =]

Chemonk

2008-07-01 18:54:06

From: jakeyboy29
were would i insert this?


That's what she said. :p

PvH

2008-07-02 02:02:04

That was what I ment, lol.
Sorry for the misunderstanding;)

Firebrand

2008-07-04 20:50:22

Won't press the First Log In button, and excuse for being a noob, but which line of code actually does ?

I've scanned the code and can't the one which presses the very first Log In :D

Ashur2Good

2008-07-05 07:35:36

I have put NaumanAkhlaQ's Fix for Log in and BobboHobbo's Log out procedure in my Login.scar just replace login scar with this one…

Scaper

2008-07-05 12:24:32

good job Nauman;)

@ashur i have also got it saved like that too! :D

kor

2008-07-05 12:41:48

Yay, way to go Nauman, you're my scripting idol :) I love your tuts and scripts, you're a cool person also. Good job.

greg3507

2008-07-14 12:51:06

From: Ashur2Good
I have put NaumanAkhlaQ's Fix for Log in and BobboHobbo's Log out procedure in my Login.scar just replace login scar with this one…

This won't work for me! I get: unknown identifier "LoggedIn"
Please help! :(

Naum

2008-07-14 15:26:36

From: kor
Yay, way to go Nauman, you're my scripting idol :) I love your tuts and scripts, you're a cool person also. Good job.


Love you too :)