Dgby714
2010-03-03 22:40:38
Changes -
- Renamed Logout to ExitToLobby and fixed it!
- Created new Logout to do ExitToLobby and click X!
- Added AtLobbyScreen;
- LoginPlayer now logs people in O.o
- Fixed RSReady
- Added Member to Players (for logging in)
Index: SRL/core/Login.scar
===================================================================
--- SRL/core/Login.scar (revision 405)
+++ SRL/core/Login.scar (working copy)
@@ -7,7 +7,9 @@
// * procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) ); // * by ZephyrsFury
// * procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fl, gt, cs: string); // * by ZephyrsFury
// * procedure SetAutoingDefaults; // * by ZephyrsFury
-// * procedure Logout; // * by Starblaster100 and Raymond
+// * function AtLobbyScreen: Boolean; // * by Dgby714
+// * function ExitToLobby; // * by Starblaster100 and Raymond
+// * function Logout; // * by Dgby714
// * procedure LoginPlayer; // * by SRL Developers
// * function NextPlayerIndex: Integer; // * by Dankness, Ron, Raymond & ZephyrsFury
// * function RandomPlayerIndex: Integer; // * by Dankness, Ron, Raymond & ZephyrsFury
@@ -36,10 +38,9 @@
Description: Returns true if we are ready to auto (on loginscreen or logged in).
Useful for waiting until RS has fully loaded.
*******************************************************************************}
-
function RSReady: Boolean;
begin
- Result := (LoggedIn) or (GetColor(748, 488) = 455491); //settings thingy button
+ Result := (LoggedIn) or (GetColor(381, 35) = 3302545); //Sword Handle (In RuneScape)
end;
{*******************************************************************************
@@ -50,14 +51,11 @@
1 2 3 4 5
<-o---o---o---o---o->
*******************************************************************************}
-
-Procedure LoginScreenMusic(State: Variant);
-
-Var
+procedure LoginScreenMusic(State: Variant);
+{var
RealState: Variant;
- x: Extended;
-
-Begin
+ x: Extended;}
+begin
{if (LoggedIn) then Exit;
TypeByte(vk_Escape);
Wait(500);
@@ -72,10 +70,9 @@
x := (421.0 - 333.0) * RealState / 4.0 + 333.0;
If CountColorTolerance(1647966, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
If CountColorTolerance(991349, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
- Mouse(Round(x), RandomRange(375, 385), 0, 0, True);
- }
+ Mouse(Round(x), RandomRange(375, 385), 0, 0, True); }
srl_Warn('LoginScreenMusic', 'Uhm yea, looks like this one is useless now.', warn_AllVersions);
-End;
+end;
{*******************************************************************************
procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );
@@ -87,7 +84,6 @@
1 2 3 4 5
Volume, SFX, Area: <-o---o---o---o---o->
*******************************************************************************}
-
procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: TSMSetting);
var
II, Tx, Ty, T, AudioMask,x,y: Integer;
@@ -215,7 +211,6 @@
By: ZephyrsFury
Description: Sets the Audio to off (1 for each bar). Works logged in and out.
*******************************************************************************}
-
procedure SetAudioOff;
begin
if (LoggedIn) then
@@ -229,7 +224,6 @@
By: ZephyrsFury
Description: Sets the graphic options for best SRL compatibility. Works both logged in and out.
*******************************************************************************}
-
procedure SetAutoingDefaults;
begin
if (LoggedIn) then
@@ -239,16 +233,25 @@
end;
{*******************************************************************************
-procedure Logout;
+function AtLobbyScreen: Boolean;
+By: Dgby714
+Description: Returns true if we are at the Lobby Screen
+*******************************************************************************}
+function AtLobbyScreen: Boolean;
+begin
+ Result := (GetColor(360, 463) = 2272229); //Click to Play Button (Inside o in to)
+end;
+
+{*******************************************************************************
+function ExitToLobby: Boolean;
By: Starblaster100 / Raymond
-Description: Logs you out.
+Description: Exits to the Lobby (for breaks?)
*******************************************************************************}
-
-function Logout: Boolean;
+function ExitToLobby: Boolean;
var
c, i: Integer;
begin
- Result := (not (LoggedIn));
+ Result := (AtLobbyScreen);
if Result = True then
Exit;
if (SRL_Procs[srl_OnLogOut] <> nil) then
@@ -259,11 +262,11 @@
while (LoggedIn) and (c < 10) do
begin
Inc(c);
- if(ClickText('here', UpChars, MIX1, MIY1, MIX2, MIY2, True))then
+ if(ClickText('xit to', UpChars, MIX1, MIY1, MIX2, MIY2, True))then
for i := 0 to 10 do
begin
Wait(1000);
- if not(LoggedIn)then
+ if AtLobbyScreen then
begin
Result := True;
Exit;
@@ -273,11 +276,54 @@
end;
{*******************************************************************************
+function Logout: Boolean;
+By: Dgby714
+Description: Logs you out.
+*******************************************************************************}
+function Logout: Boolean;
+var
+ c, i, x, y, bmpExitLobby, bmpExitLobbyHlt: Integer;
+begin
+ if (SRL_Procs[srl_OnLogOut] <> nil) then
+ SRL_Procs[srl_OnLogOut]();
+ if ExitToLobby then
+ begin
+ bmpExitLobby := BitmapFromString(2, 2, 'beNprCFWUk2ZgYASifgANeQHB');
+ bmpExitLobbyHlt := BitmapFromString(2, 2, 'beNrbUmVjacTAwAhExwEUcQKf');
+ while (AtLobbyScreen) and (c < 10) do
+ begin
+ Inc(c);
+ if FindBitmap(bmpExitLobby, x, y) then
+ begin
+ Mouse(x, y, 20, 20, true);
+ for i := 0 to 10 do
+ begin
+ Wait(1000);
+ if not(AtLobbyScreen)then
+ Result := True;
+ end;
+ end;
+ if FindBitmap(bmpExitLobbyHlt, x, y) then
+ begin
+ Mouse(x, y, 20, 20, true);
+ for i := 0 to 10 do
+ begin
+ Wait(1000);
+ if not(AtLobbyScreen)then
+ Result := True;
+ end;
+ end;
+ end;
+ FreeBitmap(bmpExitLobby);
+ FreeBitmap(bmpExitLobbyHlt);
+ end;
+end;
+
+{*******************************************************************************
procedure LoginPlayer;
By: SRL Developers
Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
*******************************************************************************}
-
procedure LoginPlayer;
var
Mark, Attempts: Integer;
@@ -290,13 +336,21 @@
Wait(100);
TypeByte(vk_Escape);
- if (GetColor(207, 409) = 238044) then //At Welcome Screen
+ if (AtLobbyScreen) then
begin
Wait(500 + Random(1000));
- MouseBox(249, 419, 521, 445, 1);
+ MouseBox(80, 450, 560, 470, 1);
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
+ if (GetColor(510, 225) = 11189701) then //Checks for Right Skull in PvP Warning
+ if AllowPVP then
+ MouseBox(400, 335, 500, 355, 1)
+ else
+ begin
+ SRL_Warn('LoginPlayer', 'Attempted to log into PVP World when AllowPVP was false. Terminating.', Warn_AllVersions);
+ TerminateScript;
+ end;
end;
if (not(RSReady)) then
begin
@@ -312,13 +366,6 @@
end;
WriteLn('Welcome to Runescape.');
end;
-
- LoginScreenMusic(True);
- if (not(GraphicsSet)) then
- begin
- SetAutoingDefaults;
- GraphicsSet := True;
- end;
ProcStart:
if (not(LoggedIn)) then
@@ -329,47 +376,40 @@
NextPlayer(False);
Exit;
end;
- Wait(900 + random(60));
+ Wait(900+random(60));
//Click 'Log In' on main menu
- while (GetColor(343, 175) <> 7750) do
+ while (GetColor(380, 310) <> 6865381) do
begin
- MouseBox(360, 184, 400, 190, 1);
- Wait(100 + Random(100));
+ if (Players[CurrentPlayer].Member <> true) then
+ MouseBox(225, 405, 365, 425, 1); //Free Login button
+ else
+ MouseBox(405, 405, 550, 425, 1) //Member Login button
+ Wait(100+Random(100));
end;
//Type Username
- Mouse(315, 272, 10, 5, True);
- while (CountColor(7750, 311, 269, 452, 284) > 0) do
+ Mouse(300, 225, 10, 5, True);
+ while (CountColor(16777215, 255, 215, 385, 230) > 0) do
begin
TypeByte(VK_BACK);
- Wait(50 + Random(50));
+ Wait(50+Random(50));
end;
- Wait(100 + Random(200));
+ Wait(100+Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
- Wait(100+random(50));
+ Wait(100+Random(50));
//Type Password
- while (CountColor(7750, 311, 337, 452, 352) > 0) do
+ while (CountColor(16777215, 255, 270, 240, 285) > 0) do
begin
TypeByte(VK_BACK);
- Wait(50 + Random(50));
+ Wait(50+Random(50));
end;
- Wait(100 + Random(200));
+ Wait(100+Random(200));
TypeSend(Players[CurrentPlayer].Pass);
- Wait(500 + Random(300));
+ Wait(500+Random(300));
- if (GetColor(315, 239) = 197552) then //Check for pvp warning and click
- if AllowPVP then
- MouseBox(434, 416, 481, 425, 1)
- else
- begin
- SRL_Warn('LoginPlayer', 'Attempted to log into PVP World when AllowPVP was false. Terminating.', Warn_AllVersions);
- TerminateScript;
- end;
-
-
MarkTime(Mark);
repeat
SetLength(Actions, 0);
@@ -377,23 +417,25 @@
if (TimeFromMark(Mark) > 60000) then
Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
else
- case (CountColor(12509695, 288, 205, 475, 247)) of //Number of text colour points
+ case (CountColor(16777215, 253, 170, 510, 290)) of //Number of text colour points
// Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
- 760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
- 536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
- 711: If (CountColor(16711680, 341, 219, 391, 233) = 128) then
- Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
- 598: Actions := ['Invalid Username / Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
- 787: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
- 408: Actions := ['World is full.', 5000, 20, 'RandomNextPlayer', ''];
- 669: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
- 555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
- 218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
- 335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
- 512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
- 489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
- 737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
- 620: Actions := ['Not high enough total level, need 1000 or higher', 0, 2, 'NextPlayer', 'Total Level to Low'];
+ 949: Actions := ['Invalid Username / Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
+ 1549: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
+ 1608: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
+ 1610: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
+ 2106: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
+
+ {Havnt been updated yet =)}
+ //711: If (CountColor(16711680, 341, 219, 391, 233) = 128) then
+ // Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
+ //555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
+ //218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
+ //335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
+ //512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
+ //489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
+
+ {Not needed anymore}
+ //536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
end;
if (Length(Actions) > 0) then
@@ -416,7 +458,7 @@
Exit;
end;
Wait(100);
- until (GetColor(207, 409) = 238044) or (LoggedIn);
+ until (AtLobbyScreen) or (LoggedIn);
if (RetryLogin) then
begin
@@ -425,11 +467,20 @@
goto ProcStart;
end;
- if (GetColor(207, 409) = 238044) then
+ if (AtLobbyScreen) then
begin
Wait(500 + Random(1000));
- MouseBox(249, 419, 521, 445, 1);
+ MouseBox(80, 450, 560, 470, 1);
end;
+ Wait(500+Random(1000));
+ if (GetColor(510, 225) = 11189701) then //Checks for Right Skull in PvP Warning
+ if AllowPVP then
+ MouseBox(400, 335, 500, 355, 1)
+ else
+ begin
+ SRL_Warn('LoginPlayer', 'Attempted to log into PVP World when AllowPVP was false. Terminating.', Warn_AllVersions);
+ TerminateScript;
+ end;
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
@@ -457,7 +508,6 @@
By: Dankness, Ron, Raymond & ZephyrsFury
Description: Returns the player number of the next active player.
*******************************************************************************}
-
function NextPlayerIndex: Integer;
begin
if (AllPlayersInactive) then
@@ -475,7 +525,6 @@
By: Dankness, Ron, Raymond & ZephyrsFury
Description: Returns the Player number of a random active player.
*******************************************************************************}
-
function RandomPlayerIndex: Integer;
var
N: Integer;
@@ -493,13 +542,13 @@
end;
Result := N;
end;
+
{*******************************************************************************
function SwitchToPlayer(PlayerNo: Integer; Active: Boolean): Boolean;
By: Dankness, Ron, Raymond & ZephyrsFury
Description: Switches to a specific player, setting the current player's
activity to True or False.
*******************************************************************************}
-
function SwitchToPlayer(PlayerNo: Integer; Active: Boolean): Boolean;
begin
WriteLn('SwitchToPlayer(PlayerNo: ' + IntToStr(PlayerNo) + ', Active: ' + BoolToStr(Active)+ ');');
@@ -521,7 +570,6 @@
Description: Logs in the next player that isn't inactive.
Boolean: True - Current player is ok. False - Current player is false.
*******************************************************************************}
-
procedure NextPlayer(Active: Boolean);
var
srl_PlayerIndexFunc: function: Integer;
@@ -552,7 +600,6 @@
Description: Logs in a random player that isn't inactive.
Boolean: True - Current player is ok. False - Current player is false.
*******************************************************************************}
-
procedure RandomNextPlayer(Active: Boolean);
var
tmpBool: Boolean;
@@ -568,7 +615,6 @@
By: Sumilion, Raymond, and Nava2
Description: Checks if all nicks are set correct.
*******************************************************************************}
-
procedure CheckUserNicks;
var
I, II: Integer;
Index: SRL/core/Players.scar
===================================================================
--- SRL/core/Players.scar (revision 405)
+++ SRL/core/Players.scar (working copy)
@@ -16,6 +16,7 @@
Name: string; // * User Name
Pass: string; // * User Pass
Pin: string; // * Current Users Pin Number
+ Member: boolean; // * For Login
Nick: string; // * Screen Name for random detection
NickTPA: TPointArray; // * TPA Of Player Name
Level: array[0..24] of Word; // * Levels of all skills.