Login¶
Handles logging in players.
Summary:
Add players with
Login.AddPlayerLogin the current player with
Login.LoginPlayerSwitch to the next player with
Login.NextPlayer
Example:
Login.AddPlayer('myusername', 'mypassword');
if not Login.LoginPlayer() then
TerminateScript('Failed to login!');
type TLoginPlayer¶
TLoginPlayer = record
User: String;
Password: String;
Pin: String;
Worlds: TIntegerArray;
Active: Boolean;
BioHash: Double;
end;
Type responsible for managing player data. You usually don’t use this directly but instead use TLogin methods to interact with TLoginPlayers stored in TLogin.Players array. The Active variable decides wether the player is inteded to be skipped or not by TLogin.
type TLogin¶
TLogin = record(TInterface)
Players: array of TLoginPlayer;
PlayerIndex: Int32;
AllowDangerousWorlds: Boolean;
end;
Type responsible for handling login and managing cached TLoginPlayers.
LOGIN_MESSAGES¶
LOGIN_MESSAGE_NONE = '';
LOGIN_MESSAGE_CONNECTING = 'Connecting to server';
LOGIN_MESSAGE_INVALID_CREDENTIALS = 'Invalid credentials';
LOGIN_MESSAGE_NEED_SKILL_TOTAL = 'You need a skill total of';
LOGIN_MESSAGE_INVALID_USER_PASS = 'Please enter your username/email address.';
LOGIN_MESSAGE_ERROR_CONNECTING = 'Error connecting to server';
LOGIN_MESSAGE_ACCOUNT_NOT_LOGGED_OUT = 'Your account has not logged out';
LOGIN_MESSAGE_LOGIN_SERVER_OFFLINE = 'Login server offline';
LOGIN_MESSAGE_ERROR_LOADING_PROFILE = 'Error loading your profile';
LOGIN_MESSAGE_CONNECTION_TIMED_OUT = 'Connection timed out';
LOGIN_MESSAGE_LOGIN_LIMIT_EXCEEDED = 'Login limit exceeded';
LOGIN_MESSAGE_WORLD_FULL = 'This world is full';
LOGIN_MESSAGE_ACCOUNT_DISABLED = 'Your account has been disabled';
LOGIN_MESSAGE_ACCOUNT_RULE_BREAKER = 'Your account has been involved';
LOGIN_MESSAGE_MEMBERS = 'You need a members account';
LOGIN_MESSAGE_IN_MEMBERS_AREA = 'You are standing in a members-only area';
LOGIN_MESSAGE_AUTHENTICATOR = 'Authenticator';
Global constants for most if not all login messages.
Each of this messages is stored in LOGIN_MESSAGES in the same order.
Login.FindText¶
function TLogin.FindText(Text: String; out B: TBox): Boolean;
function TLogin.FindText(Text: String): Boolean; overload;
Internal TLogin method used to find a message on the TLogin interface. You probably will never to use this directly.
Login.IsReady¶
function TLogin.IsReady(): Boolean;
Checks if the login screen is ready to login. In other words, has no dialogs up.
Example:
WriteLn Login.IsReady();
Login.UsingLauncher¶
function TLogin.UsingLauncher(): Boolean;
Checks if the client was launched by a launcher (Steam/Jagex Launcher) or was manually ran by the user.
Example:
WriteLn Login.UsingLauncher();
Login.ClickText¶
function TLogin.ClickText(Text: String): Boolean;
Internal TLogin method used to find the specified Text on the TLogin interface and click it. You probably will never to use this directly.
Login.ClickWorld¶
function TLogin.ClickWorld(World: Int32): Boolean;
Internal TLogin method used to click a world on the login interface. You probably will never to use this directly.
Login.IsOpen¶
function TLogin.IsOpen(): Boolean;
TLogin method used to check if we are on the login screen.
Example:
WriteLn Login.IsOpen();
Login.IsWorldSwitcherOpen¶
function TLogin.IsWorldSwitcherOpen(): Boolean;
TLogin method used to check if the login world switcher is open.
Example:
WriteLn Login.IsWorldSwitcherOpen();
Login.OpenWorldSwitcher¶
function TLogin.OpenWorldSwitcher(): Boolean;
TLogin method used to open the login screen world switcher.
Example:
if not Login.IsWorldSwitcherOpen() then
WriteLn Login.OpenWorldSwitcher();
Login.CloseWorldSwitcher¶
function TLogin.CloseWorldSwitcher(): Boolean;
TLogin method used to close the login screen world switcher.
Example:
if Login.IsWorldSwitcherOpen() then
WriteLn Login.CloseWorldSwitcher();
Login.GetCurrentWorld¶
function TLogin.GetCurrentWorld(): Int32;
Returns the currently selected world.
Example:
WriteLn Login.GetCurrentWorld();
Login.SwitchToWorld¶
function TLogin.SwitchToWorld(World: Int32): Boolean;
Attempts to switch the current world to the World specified.
Example:
WriteLn Login.SwitchToWorld(303);
Login.HandleDialogs¶
function TLogin.HandleDialogs(): Boolean;
Internal TLogin method used to handle the dialog messages. You probably will never need to call this directly.
Login.EnterField¶
function TLogin.EnterField(Field, Details: String): Boolean;
Used to enter player details in the login screen. This is not an internal method but you probably will never need to call this directly.
Example:
WriteLn Login.EnterField('Login:', 'my user name') and
Login.EnterField('Password:', 'my password');
Login.GetLoginMessage¶
function TLogin.GetLoginMessage(): String;
Returns the login message that matches any of the messages stored in the constant LOGIN_MESSAGES. This is not an internal method but you probably will never need to call this directly.
Example:
WriteLn Login.GetLoginMessage();
Login.HandleMessage¶
function TLogin.HandleMessage(Message: String): Boolean;
Attempts to handle the currently displayed login message. This is not an internal method but you probably will never need to call this directly.
Example:
WriteLn Login.HandleMessage(Login.GetLoginMessage());
Login.EnterGame¶
function TLogin.EnterGame(): Boolean;
Attempts to login into the game. This is not an internal method but you probably will never need to call this directly. This assumes that the player username and password are already filled in.
Example:
if Login.EnterField('Login:', 'my user name') and
Login.EnterField('Password:', 'my password') then
WriteLn Login.EnterGame();
Login.GetPlayer¶
function TLogin.GetPlayer(): TLoginPlayer;
Returns the currently selected TLoginPlayer. The currently selected TLoginPlayer is decided by TLogin.PlayerIndex which is an index of the TLogin.Players array.
Example:
WriteLn Login.GetPlayer().Username;
Login.DoLogin¶
function TLogin.DoLogin(player: TLoginPlayer; launcher: Boolean = False): Boolean;
Performs a login in the loginscreen with the specified player.
Login.WaitLoginMessage¶
function TLogin.WaitLoginMessage(): Boolean;
Waits for a login message after a login was performed, returns true if we successfully enter the game lobby.
Login.LoginPlayer¶
function TLogin.LoginPlayer(): Boolean;
Attempts to login the current selected player into the game. The currently selected player is decided by TLogin.PlayerIndex which is an index of the TLogin.Players array.
Example:
WriteLn Login.LoginPlayer();
Login.LoginPlayer overload which allows for fully customizable hop and percentage.¶
It’s coded to behave as the default if you just prefer having the option to customize.
function TLogin.LoginPlayer(randomHop; hopChance): Boolean; overload;
Attempts to login the current selected player into the game. The currently selected player is decided by TLogin.PlayerIndex which is an index of the TLogin.Players array.
Example:
WriteLn Login.LoginPlayer(True, 90); // When on the main login lobby, has a 90% chance to hop
Login.AddPlayer¶
procedure TLogin.AddPlayer(user, pass: String; pin: String = ''; worlds: TIntegerArray = []);
Adds a TLoginPlayer to the TLogin.Players array.
Example:
Login.AddPlayer('my username', 'my password', '0000'); //Adds a player to TLogin.Players
Login.PlayerIndex := High(Login.Players); //Our added TLoginPlayer will be the last in the array.
Login.LoginPlayer(); //Login Login.Players[Login.PlayerIndex]
Login.NextPlayer¶
procedure TLogin.NextPlayer(DisableCurrentPlayer: Boolean);
This basically increments TLogin.PlayerIndex to the next TLoginPlayer that has the Active variable set to true. If TLogin.PlayerIndex is already set to our last TLoginPlayer, then it’s reset to 0 and set to the first Active player.
Example:
WriteLn Login.PlayerIndex;
Login.NextPlayer(True); //Make sure you have a couple of players to run this example properly.
WriteLn Login.PlayerIndex;
Login.GetPlayerPin¶
function TLogin.GetPlayerPin(): String;
Get the current player bank pin.
Example:
if BankPin.IsOpen() then
BankPin.Enter(Login.GetPlayerPin());
Login.GetPlayerBioHash¶
function TLogin.GetPlayerBioHash(): Double;
Get the current player BioHash.
Example:
WriteLn Login.GetPlayerBioHash();
Login.Draw¶
procedure TLogin.Draw(Bitmap: TMufasaBitmap); override;
Internal TLogin method used for debugging. You probably will never need to call this directly but can be useful for debugging. This is automatically called with SRL.Debug().
Example:
SRL.Debug();
Login.Setup¶
procedure TLogin.Setup(); override;
Internal TLogin setup method. This is automatically called by SRL and you probably will never need to call this directly.
Login.SetupAlignment¶
procedure TLogin.SetupAlignment(); overload;
Internal TLogin aligment method. This is automatically called by SRL and you probably will never need to call this directly.
This is responsible for setting up the TLogin interface coordinates.
var Login¶
Global TLogin variable.