Login
Handles logging in players.
Summary:
Add players with Login.AddPlayer
Login the current player with Login.LoginPlayer
Switch to the next player with Login.NextPlayer
Example
Login.AddPlayer('myusername', 'mypassword');
if not Login.LoginPlayer() then
TerminateScript('Failed to login!');
type TRSLoginPlayer
TRSLoginPlayer = 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 TRSLogin methods to interact with TRSLoginPlayers stored in TRSLogin.Players array. The Active variable decides wether the player is inteded to be skipped or not by TRSLogin.
type TRSLogin
TRSLogin = record(TRSInterface)
Players: array of TRSLoginPlayer;
PlayerIndex: Int32;
AllowDangerousWorlds: Boolean;
end;
Type responsible for handling login and managing cached TRSLoginPlayers.
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 TRSLogin.FindText(Text: String; out B: TBox): Boolean;
function TRSLogin.FindText(Text: String): Boolean; overload;
Internal TRSLogin method used to find a message on the TRSLogin interface. You probably will never to use this directly.
Login.ClickText
function TRSLogin.ClickText(Text: String): Boolean;
Internal TRSLogin method used to find the specified Text on the TRSLogin interface and click it. You probably will never to use this directly.
Login.ClickWorld
function TRSLogin.ClickWorld(World: Int32): Boolean;
Internal TRSLogin method used to click a world on the login interface. You probably will never to use this directly.
Login.IsOpen
function TRSLogin.IsOpen(): Boolean;
TRSLogin method used to check if we are on the login screen.
Example
WriteLn Login.IsOpen();
Login.IsWorldSwitcherOpen
function TRSLogin.IsWorldSwitcherOpen(): Boolean;
TRSLogin method used to check if the login world switcher is open.
Example
WriteLn Login.IsWorldSwitcherOpen();
Login.OpenWorldSwitcher
function TRSLogin.OpenWorldSwitcher(): Boolean;
TRSLogin method used to open the login screen world switcher.
Example
if not Login.IsWorldSwitcherOpen() then
WriteLn Login.OpenWorldSwitcher();
Login.CloseWorldSwitcher
function TRSLogin.CloseWorldSwitcher(): Boolean;
TRSLogin method used to close the login screen world switcher.
Example
if Login.IsWorldSwitcherOpen() then
WriteLn Login.CloseWorldSwitcher();
Login.GetCurrentWorld
function TRSLogin.GetCurrentWorld(): Int32;
Returns the currently selected world.
Example
WriteLn Login.GetCurrentWorld();
Login.SwitchToWorld
function TRSLogin.SwitchToWorld(World: Int32): Boolean;
Attempts to switch the current world to the World specified.
Example
WriteLn Login.SwitchToWorld(303);
Login.HandleDialogs
function TRSLogin.HandleDialogs(): Boolean;
Internal TRSLogin method used to handle the dialog messages. You probably will never need to call this directly.
Login.EnterField
function TRSLogin.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 TRSLogin.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 TRSLogin.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 TRSLogin.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 TRSLogin.GetPlayer(): TRSLoginPlayer;
Returns the currently selected TRSLoginPlayer. The currently selected TRSLoginPlayer is decided by TRSLogin.PlayerIndex which is an index of the TRSLogin.Players array.
Example
WriteLn Login.GetPlayer().Username;
Login.LoginPlayer
function TRSLogin.LoginPlayer(): Boolean;
Attempts to login the current selected player into the game. The currently selected player is decided by TRSLogin.PlayerIndex which is an index of the TRSLogin.Players array.
Example
WriteLn Login.LoginPlayer();
Login.AddPlayer
procedure TRSLogin.AddPlayer(User, Pass: String; Pin: String = ''; Worlds: TIntegerArray = []);
Adds a TRSLoginPlayer to the TRSLogin.Players array.
Example
Login.AddPlayer('my username', 'my password', '0000'); //Adds a player to TRSLogin.Players
Login.PlayerIndex := High(Login.Players); //Our added TRSLoginPlayer will be the last in the array.
Login.LoginPlayer(); //Login Login.Players[Login.PlayerIndex]
Login.NextPlayer
procedure TRSLogin.NextPlayer(DisableCurrentPlayer: Boolean);
This basically increments TRSLogin.PlayerIndex to the next TRSLoginPlayer that has the Active variable set to true. If TRSLogin.PlayerIndex is already set to our last TRSLoginPlayer, 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 TRSLogin.GetPlayerPin(): String;
Get the current player bank pin.
Example
if BankPin.IsOpen() then
BankPin.Enter(Login.GetPlayerPin());
Login.GetPlayerBioHash
function TRSLogin.GetPlayerBioHash(): Double;
Get the current player BioHash.
Example
WriteLn Login.GetPlayerBioHash();
Login.Draw
procedure TRSLogin.Draw(Bitmap: TMufasaBitmap); override;
Internal TRSLogin 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 TRSLogin.Setup(); override;
Internal TRSLogin setup method. This is automatically called by SRL and you probably will never need to call this directly.
Login.SetupAlignment
procedure TRSLogin.SetupAlignment(Mode: ERSClientMode); override;
Internal TRSLogin 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 TRSLogin interface coordinates.
var Login
Global TRSLogin variable.