Dgby714
2010-03-08 15:05:25
Fixes a LOT of the standards in SRL =)
2010-03-08 15:05:25
2010-03-08 16:29:18
2010-03-08 16:31:49
2010-03-08 16:33:30
From: Wizzup?
Perhaps this is a good idea. ;)
2010-03-08 16:43:49
2010-03-08 19:59:02
2010-03-09 06:42:36
2010-03-10 08:26:03
2010-03-27 09:07:02
2010-03-27 10:49:57
From: mastaraymond
Committed it :-). There were a few files conflicting though, so if you can update your patch?
Index: SRL/core/Globals.scar
===================================================================
--- SRL/core/Globals.scar (revision 421)
+++ SRL/core/Globals.scar (working copy)
@@ -10,7 +10,7 @@
{ const SRLVersionNumber;
Description: Repository Version Number. }
-Const
+const
SRLVersionNumber = 38;
{ var TalkAfterRandoms: Boolean;
@@ -27,12 +27,11 @@
{var Fontpath,includepath : string;
Description: Path to the font folder and include folder}
-{$ifndef Simba}
+{$IFNDEF Simba}
var
FontPath, IncludePath : string;
-{$endif}
+{$ENDIF}
-
{ var bmpAdmin, bmpMod, Lamp, BoxMask: Integer;
Description: Global Bitmaps. Need to be Global because of SCAR Memory leaks. }
var
@@ -133,6 +132,7 @@
srl_InNextPlayerLoop = 10; //During the infinite loop in NextPlayer when all players are inactive.
srl_OnCustomRC = 11; //When custom RC trigger has been given.
srl_OnExitToLobby = 12; //On exit to lobby
+
{ var SRL_Procs: array [0..12] of procedure();
Description: Varibles to store user-defined procs to be called in SRL. }
var
@@ -140,7 +140,6 @@
{ const GameTab Constants;
Description: Constants representing gametab numbers. }
-
const
tab_Combat = 21;
tab_Stats = 22;
Index: SRL/core/Inventory.scar
===================================================================
--- SRL/core/Inventory.scar (revision 421)
+++ SRL/core/Inventory.scar (working copy)
@@ -30,7 +30,6 @@
// * function ItemActivated(Slot: Integer): Boolean; // by marpis
// * function FindActiveItemSlot: TBox; // by EvilChicken!
-
{ type TInvenItem;
Description: Holds data regarding an inventory item }
type
@@ -412,6 +411,7 @@
for I := 0 to Len - 1 do
DropItem(InvSlots[I]);
end;
+
const
dp_UpToDown = 1;
dp_Snake = 2;
@@ -635,4 +635,4 @@
GameTab(tab_Inv);
if (FindColor(X, Y, 16777215, MIX1, MIY1, MIX2, MIY2)) then
Result := InvBox(CoordsToItem(X, Y));
-end;
\ No newline at end of file
+end;
Index: SRL/core/Login.scar
===================================================================
--- SRL/core/Login.scar (revision 421)
+++ SRL/core/Login.scar (working copy)
@@ -2,31 +2,31 @@
//-- Scar Standard Resource Library --//
//-- » Login Routines --//
//-----------------------------------------------------------------//
-// * function RSReady: Boolean; // * by ZephyrsFury
-// * Procedure LoginScreenMusic(State: Variant); // * by Wizzup?
-// * 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
-// * function LoginPlayerToLob: Boolean; // * by ZephyrsFury
-// * function AtLobbyScreen: Boolean; // * by Dgby714
-// * function ExitToLobby; // * by Starblaster100 and Raymond
-// * function Logout: Boolean; // * by IceFire908
-// * function LoginPlayerToLob: Boolean; // * by The SRL Team
-// * function LogInPlayer: Boolean; // * by The SRL Team
-// * function NextPlayerIndex: Integer; // * by Dankness, Ron, Raymond & ZephyrsFury
-// * function RandomPlayerIndex: Integer; // * by Dankness, Ron, Raymond & ZephyrsFury
-// * function SwitchToPlayer(PlayerNo: Integer; Active: Boolean): Boolean; // * by Dankness, Ron, Raymond & ZephyrsFury
-// * procedure NextPlayer(Active: Boolean); // * by ZephyrsFury
-// * procedure RandomNextPlayer(Active: Boolean); // * by ZephyrsFury
-// * procedure CheckUserNicks; // * by Sumilion, Raymond and Nava2
+// * function RSReady: Boolean; // by ZephyrsFury
+// * Procedure LoginScreenMusic(State: Variant); // by Wizzup?
+// * 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 SetAudioOff; // by ZephyrsFury
+// * procedure SetAutoingDefaults; // by ZephyrsFury
+// * function LobbyScreen: Boolean; // by IceFire908 & Bionicle1800
+// * function ExitToLobby; // by Starblaster100 and Raymond
+// * function LeaveLobby: Boolean; // by IceFire908
+// * function Logout: Boolean; // by IceFire908
+// * function LoginPlayerToLob: Boolean; // by The SRL Team
+// * function LogInPlayer: Boolean; // by The SRL Team
+// * function NextPlayerIndex: Integer; // by Dankness, Ron, Raymond & ZephyrsFury
+// * function RandomPlayerIndex: Integer; // by Dankness, Ron, Raymond & ZephyrsFury
+// * function SwitchToPlayer(PlayerNo: Integer; Active: Boolean): Boolean; // by Dankness, Ron, Raymond & ZephyrsFury
+// * procedure NextPlayer(Active: Boolean); // by ZephyrsFury
+// * procedure RandomNextPlayer(Active: Boolean); // by ZephyrsFury
+// * procedure CheckUserNicks; // by Sumilion, Raymond and Nava2
const
SM_Color = 8115338;
{ var SRL_Logs: Integer;
+ var RandomPlayer, GraphicsSet: Boolean;
Description: Variables needed for some login functions. }
-{ var RandomPlayer, GraphicsSet: Boolean;
- Description: Variables needed for some login functions. }
var
SRL_Logs: Integer;
RandomPlayer, GraphicsSet, AllowPVP: Boolean;
@@ -62,7 +62,7 @@
ERROR_BOX = 2044518; // Error box (comes up on incorrect pw/un or banned acc
SWORD_COLOR = 11848397; // used for RSReady (the sword between "Runescape" title
-const //GetScreen
+const //GetScreen
LOGIN_TA_X1 = 210; //Text check area
LOGIN_TA_Y1 = 54;
LOGIN_TA_X2 = 556;
@@ -70,21 +70,17 @@
LOGIN_TEXTCOLOUR = clWhite; //Colour of text
-
-
{*******************************************************************************
function RSReady: Boolean;
By: ZephyrsFury
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(749, 492) = 65536); //settings thingy button
end;
-
{*******************************************************************************
Procedure LoginScreenMusic(State: Variant);
By: Wizzup?
@@ -325,7 +321,6 @@
By: IceFire908
Description: Logs you out from lobby screen.
*******************************************************************************}
-
function LeaveLobby: Boolean;
var
T: LongInt;
@@ -344,7 +339,6 @@
By: IceFire908
Description: Logs you all the way out from ingame.
*******************************************************************************}
-
function Logout: Boolean;
begin
if (SRL_Procs[srl_OnLogOut] <> nil) then
@@ -358,7 +352,6 @@
By: The SRL Team
Description: Like LoginPlayer but only to the lobbyscreen.
*******************************************************************************}
-
function LoginPlayerToLob: Boolean;
var
Members, RetryLogin: Boolean;
@@ -367,13 +360,10 @@
label
ProcStart;
begin
-
{$IFNDEF SRL_SMART}
-
ActivateClient;
Wait(100);
TypeByte(vk_Escape);
-
{$ENDIF}
{Check for lobby screen already open/ already logged in}
@@ -536,7 +526,6 @@
By: The SRL Team
Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
*******************************************************************************}
-
function LoginPlayer: Boolean;
var
RetryLogin, B, BB: Boolean;
@@ -547,9 +536,7 @@
begin
ProcStart:
- {Check if Logged in}
-
- if (not (Result)) then
+ if (not (Result)) then {Check if Logged in}
Result := LoggedIn;
if (Result) then
@@ -559,13 +546,10 @@
PlayerStartTime := GetSystemTime; // PlayerStartTime
Exit;
end;
- {Get to lobby screen}
-
- if (not (LoginPlayerToLob)) then
+ if (not (LoginPlayerToLob)) then {Get to lobby screen}
Exit;
Wait(500 + Random(500));
{World switching}
-
if (Length(Players[CurrentPlayer].WorldInfo) > 0) then
if (Players[CurrentPlayer].WorldInfo[0]) then
Players[CurrentPlayer].Member := True
@@ -586,7 +570,6 @@
SelectWorld(RandomWorld(B, BB));
end;
end;
-
{Click Here to Play}
MouseBox(72, 445, 570, 477, 1); //Button
Index: SRL/core/Text.scar
===================================================================
--- SRL/core/Text.scar (revision 421)
+++ SRL/core/Text.scar (working copy)
@@ -2,33 +2,33 @@
//-- Scar Standard Resource Library --//
//-- » Text Routines --//
//-----------------------------------------------------------------//
-// * function srl_Explode(str, del: string): TStringArray; // * by mixster
+// * function srl_Explode(str, del: string): TStringArray; // by mixster
// * function srl_Implode(Pieces: TStringArray; Separator: string): string; // * by ZephyrsFury & mixster
-// * procedure TypeByte(k: Byte); // * by Mutant Squirrle
-// * procedure TypeSendEx(Text: string; PressEnter: Boolean); // * by SKy Scripter
-// * procedure TypeSend(Text: String); // * by N1ke!
-// * function AddMistakes(Orig: string; Chance: Integer): string; // * by ZephyrsFury
-// * function GetUpText: String; // * by Freddy1990
-// * function IsUpText(UpText: String): Boolean; // * by Masquerader / Nielsie95 / Freddy1990
-// * function IsUpTextMultiCustom(Text: TStringArray): Boolean; // * by Starblaster100 / Nielsie95 / Freddy1990
-// * function GetLevelAtPos(x, y: Integer): integer; // * by marpis and Nava2
-// * function FindNPCChatText(txt: string; Action: (ClickLeft,ClickRight,Move,Nothing)): Boolean; // * by Kernel Klink and Nielsie95
-// * function FindText(var cx, cy: Integer; txt: String; font, xs, ys, xe, ye: Integer): Boolean; // * by Stupid3ooo
-// * function ClickText(txt: String; font, x1, y1, x2, y2: Integer; left: Boolean): Boolean; // * by Stupid3ooo and SKy Scripter
-// * Function LoadTextTPA(Text : String; Chars : Integer;var height : integer) : TPointArray; // * by Raymond
-// * Function FindTextTpaEx(Color, Tol, xs, ys, xe, ye: integer; var x,y: integer; Txt: string; Chars: Integer; Action: (ClickLeft, ClickRight, Move, Nothing)): Boolean; // * by Raymond
-// * Function FindTextTpa(Color, Tol, xs, ys, xe, ye: integer; Txt: string; Chars: Integer; Action: (ClickLeft, ClickRight, Move, Nothing)): Boolean; // * by Raymond
-// * function ChooseOptionMultiEx(Texts: TStringArray; TextType: String; Action: fnct_ActionOptions): Boolean; // * by Wizzup?, Nava2, and modified by N1ke!
-// * function ChooseOptionMulti(Text: TStringArray): Boolean; // * by Wizzup? modified by N1ke!
-// * function ChooseOptionEx(Txt, TextType: String): Boolean; // * by Wizzup?, Nava2, and modified by N1ke!
-// * function ChooseOption(txt: String): Boolean; // * by Stupid3ooo, modded by Sumilion
-// * Function OptionsExist(txt: TStringArray; MoveMouse: boolean): boolean; // * by Rasta Magician
-// * procedure CloseWindow; // * by Solemn Wishes, Starblaster100 and ZephyrsFury
-// * Function InStrArrEx(S: String; StrArr: TStringArray; Var W: Integer): Boolean; // * by n3ss3s
-// * function StrInArr(str: string; arrS: TStringArray): Boolean; // * by Narcle & Nava2
-// * function ArrInStr(arrS: TStringArray; str: string): Boolean; // * by Narcle & Nava2
-// * procedure SetDebugColors(Text, Back: Integer); // * by Nava2
-// * procedure WriteArrayCols(Lines: TStringArray; Text, Back: Integer); // * by Nava2
+// * procedure TypeByte(k: Byte); // by Mutant Squirrle
+// * procedure TypeSendEx(Text: string; PressEnter: Boolean); // by SKy Scripter
+// * procedure TypeSend(Text: String); // by N1ke!
+// * function AddMistakes(Orig: string; Chance: Integer): string; // by ZephyrsFury
+// * function GetUpText: String; // by Freddy1990
+// * function IsUpText(UpText: String): Boolean; // by Masquerader / Nielsie95 / Freddy1990
+// * function IsUpTextMultiCustom(Text: TStringArray): Boolean; // by Starblaster100 / Nielsie95 / Freddy1990
+// * function GetLevelAtPos(x, y: Integer): integer; // by marpis and Nava2
+// * function FindNPCChatText(txt: string; Action: (ClickLeft,ClickRight,Move,Nothing)): Boolean; // by Kernel Klink and Nielsie95
+// * function FindText(var cx, cy: Integer; txt: String; font, xs, ys, xe, ye: Integer): Boolean; // by Stupid3ooo
+// * function ClickText(txt: String; font, x1, y1, x2, y2: Integer; left: Boolean): Boolean; // by Stupid3ooo and SKy Scripter
+// * Function LoadTextTPA(Text : String; Chars : Integer;var height : integer) : TPointArray; // by Raymond
+// * Function FindTextTpaEx(Color, Tol, xs, ys, xe, ye: integer; var x,y: integer; Txt: string; Chars: Integer; Action: (ClickLeft, ClickRight, Move, Nothing)): Boolean; // by Raymond
+// * Function FindTextTpa(Color, Tol, xs, ys, xe, ye: integer; Txt: string; Chars: Integer; Action: (ClickLeft, ClickRight, Move, Nothing)): Boolean; // by Raymond
+// * function ChooseOptionMultiEx(Texts: TStringArray; TextType: String; Action: fnct_ActionOptions): Boolean; // by Wizzup?, Nava2, and modified by N1ke!
+// * function ChooseOptionMulti(Text: TStringArray): Boolean; // by Wizzup? modified by N1ke!
+// * function ChooseOptionEx(Txt, TextType: String): Boolean; // by Wizzup?, Nava2, and modified by N1ke!
+// * function ChooseOption(txt: String): Boolean; // by Stupid3ooo, modded by Sumilion
+// * Function OptionsExist(txt: TStringArray; MoveMouse: boolean): boolean; // by Rasta Magician
+// * procedure CloseWindow; // by Solemn Wishes, Starblaster100 and ZephyrsFury
+// * Function InStrArrEx(S: String; StrArr: TStringArray; Var W: Integer): Boolean; // by n3ss3s
+// * function StrInArr(str: string; arrS: TStringArray): Boolean; // by Narcle & Nava2
+// * function ArrInStr(arrS: TStringArray; str: string): Boolean; // by Narcle & Nava2
+// * procedure SetDebugColors(Text, Back: Integer); // by Nava2
+// * procedure WriteArrayCols(Lines: TStringArray; Text, Back: Integer); // by Nava2
{ var OldLine,TheLine, TheName: String;
Description: ChatLog vars. }
@@ -271,12 +271,12 @@
{$IFDEF SIMBA}
Result := rs_GetUpText
{$ELSE}
- {$IFDEF SCAR322_UP}
- Result := rs_GetUpText;
- {$ELSE}
- Result := rs_GetUpTextAt(8, 8, 25);
- {$ENDIF}
+ {$IFDEF SCAR322_UP}
+ Result := rs_GetUpText;
+ {$ELSE}
+ Result := rs_GetUpTextAt(8, 8, 25);
{$ENDIF}
+ {$ENDIF}
end;
{*******************************************************************************
@@ -361,13 +361,13 @@
By: Stupid3ooo
Description: Searches for text in specified box with specified font.
*******************************************************************************}
-{$ifdef Simba}
+{$IFDEF SIMBA}
function FindText(var cx, cy: Integer; txt,font: string; xs, ys, xe, ye:
- Integer): Boolean; //by Stupid3ooo
-{$else}
+ Integer): Boolean;
+{$ELSE}
function FindText(var cx, cy: Integer; txt: string; font, xs, ys, xe, ye:
- Integer): Boolean; //by Stupid3ooo
-{$endif}
+ Integer): Boolean;
+{$ENDIF}
var
S: Integer;
begin
@@ -383,11 +383,11 @@
By: SKy Scripter
Description: Clicks text if found in box.
*******************************************************************************}
-{$ifdef Simba}
+{$IFDEF SIMBA}
function ClickText(Text, Chars: string;x1, y1, x2, y2: Integer; Left: Boolean): Boolean;
-{$else}
+{$ELSE}
function ClickText(Text: string; Chars, x1, y1, x2, y2: Integer; Left: Boolean): Boolean;
-{$endif}
+{$ENDIF}
var
Mask, w, h, tx, ty: Integer;
begin
@@ -411,11 +411,11 @@
of the Text.. Used in FindTextTPAinTPA
*******************************************************************************}
{$IFNDEF SIMBA}
-function LoadTextTPA(Text: String; Chars: Integer; var height: integer): TPointArray;
+function LoadTextTPA(Text: string; Chars: Integer; var height: integer): TPointArray;
var
- DC : HDC;
- CTS,w,h : INteger;
- BMP : Integer;
+ DC: HDC;
+ CTS, w, h :INteger;
+ BMP: Integer;
begin;
BMP := CreateBitmapMaskFromText(Text,Chars);
DC := GetClientCanvas.Handle;
@@ -429,15 +429,15 @@
ColorToleranceSpeed(CTS);
FreeBitmap(BMP);
end;
-{$else}
+{$ELSE}
function LoadTextTPA(Text, Chars: string; var height: integer): TPointArray;
var
- w : integer;
+ w: integer;
begin
result := TPAFromText(text,chars,w,height);
dec(height);
end;
-{$endif}
+{$ENDIF
{*******************************************************************************
@@ -450,11 +450,11 @@
Clickleft - Movemouse & Clickmouse left
Clickright - MoveMouse & Clickmouse right
*******************************************************************************}
-{$ifdef Simba}
+{$IFDEF SIMBA}
function FindTextTpaEx(Color,Tol,xs,ys,xe,ye : integer;var x,y : integer; Txt, Chars : string; Action :fnct_ActionOptions ) : Boolean;
-{$else}
+{$ELSE}
function FindTextTpaEx(Color,Tol,xs,ys,xe,ye : integer;var x,y : integer; Txt : string; Chars : Integer; Action :fnct_ActionOptions ) : Boolean;
-{$endif}
+{$ENDIF}
var
TextTPA,SearchTPA, Matches: TPointArray;
Box : TBox;
@@ -491,11 +491,11 @@
By: Raymond
Description: Just like FindTextTPAEx, but without the x and y pos returning.
*******************************************************************************}
-{$ifdef simba}
-function FindTextTpa(Color,Tol,xs,ys,xe,ye : integer; Txt,Chars : String; Action :fnct_ActionOptions ) : Boolean;
-{$else}
-function FindTextTpa(Color,Tol,xs,ys,xe,ye : integer; Txt : string; Chars : Integer; Action :fnct_ActionOptions ) : Boolean;
-{$endif}
+{$IFDEF SIMBA}
+function FindTextTpa(Color, Tol, xs, ys, xe, ye: integer; Txt, Chars: string; Action: fnct_ActionOptions): Boolean;
+{$ELSE}
+function FindTextTpa(Color, Tol, xs, ys, xe, ye: integer; Txt: string; Chars : Integer; Action: fnct_ActionOptions): Boolean;
+{$ENDIF}
var
x,y : integer;
begin
@@ -750,7 +750,7 @@
procedure SetDebugColors(txtCol, BackCol: Integer);
{$IFDEF SCAR320_UP}
var
- T:TDebugParams;
+ T: TDebugParams;
begin
T.BackColor := BackCol;
T.Color := txtCol;
Index: SRL/core/Timing.scar
===================================================================
--- SRL/core/Timing.scar (revision 421)
+++ SRL/core/Timing.scar (working copy)
@@ -31,11 +31,8 @@
Date_Month = 2;
Date_Day = 3;
- {
- const srl_MaxWaitTime;
- Description: Used when ever WaitFunc is used in SRL. Increase for slow
- computers.
- }
+{ const srl_MaxWaitTime;
+ Description: Used when ever WaitFunc is used in SRL. Increase for slow computers. }
srl_MaxWaitTime = 400;
function InvCount: byte; forward;
@@ -83,7 +80,7 @@
By: Rasta Magician
Description: Returns Time since the script was started (GetTimeRunning).
*******************************************************************************}
-function TimeRunning: String;
+function TimeRunning: string;
begin
Result := MsToTime(GetTimeRunning, Time_Formal);
end;
@@ -182,7 +179,6 @@
function WaitOptionMultiEx(S: TStringArray; TextType: string; Action: fnct_ActionOptions; Time: Integer): Boolean;
var
T: Integer;
-
begin
Result := False;
T := GetSystemTime + Time;
@@ -212,7 +208,7 @@
By: Infantry001
Description: Waits for an Option and selects it. Searches for TextType.
*******************************************************************************}
-function WaitOptionEx(S, TextType: String; Action: fnct_ActionOptions; Time: Integer): Boolean;
+function WaitOptionEx(S, TextType: string; Action: fnct_ActionOptions; Time: Integer): Boolean;
begin
Result := WaitOptionMultiEx([S], TextType, Action, Time);
end;
@@ -222,7 +218,7 @@
By: N1ke!
Description: Waits for an Option and selects it
*******************************************************************************}
-function WaitOption(S: String; Time: Integer): Boolean;
+function WaitOption(S: string; Time: Integer): Boolean;
begin
Result := WaitOptionMultiEx([S], 'all', ClickLeft, Time);
end;
@@ -408,7 +404,7 @@
is open every 10-25th millisecond, for a maximum of 750 milliseconds.
Notice the '@'.
*******************************************************************************}
-function WaitFunc(Func: Function: Boolean; WaitPerLoop, MaxTime: Integer): Boolean;
+function WaitFunc(Func: function: Boolean; WaitPerLoop, MaxTime: Integer): Boolean;
var
T: Integer;
begin
@@ -422,4 +418,4 @@
end;
Wait(WaitPerLoop);
end;
-end;
\ No newline at end of file
+end;
Index: SRL/core/WorldSwitcher.scar
===================================================================
--- SRL/core/WorldSwitcher.scar (revision 421)
+++ SRL/core/WorldSwitcher.scar (working copy)
@@ -2,19 +2,19 @@
//-- Scar Standard Resource Library --//
//-- » WorldSwitch routines --//
//-----------------------------------------------------------------//
-// * function WorldScreen: Boolean; // by Narcle
-// * function OpenWorldScreen: Boolean; // by Bionicle1800
-// * function UpdateWorlds: Boolean; // by mixster & Nava2
-// * procedure LoadWorldArrays; // by Narcle
-// * function FindWorld(W: integer): Boolean; // by Narcle
+// * function WorldScreen: Boolean; // by Narcle
+// * function OpenWorldScreen: Boolean; // by Bionicle1800
+// * function UpdateWorlds: Boolean; // by mixster & Nava2
+// * procedure LoadWorldArrays; // by Narcle
+// * function FindWorld(W: integer): Boolean; // by Narcle
// * function GetWorldInfo(World: Integer; var WorldRec: TWorld): Boolean; // by Narcle
-// * function WS_CurrentWorld(var World: Integer): Boolean; // by IceFire908
+// * function WS_CurrentWorld(var World: Integer): Boolean; // by IceFire908
// * function GetWorldInfo(World: Integer; var WorldRec: TWorld): Boolean; // by Narcle
-// * function FindWorld(W: integer): Boolean; // by Narcle
-// * function SelectWorld(WorldNumber: Integer): Boolean; // by Narcle & ZephyrsFury
-// * function RandomWorld(Members, PvP: Boolean): Integer; // by Narcle & mixster
-// * function ChangeWorld(W: Integer): Boolean; // by Nava2
-// * Procedure OrderWorlds(by: string; Descending: boolean); // by NaumanAkhlaQ
+// * function FindWorld(W: integer): Boolean; // by Narcle
+// * function SelectWorld(WorldNumber: Integer): Boolean; // by Narcle & ZephyrsFury
+// * function RandomWorld(Members, PvP: Boolean): Integer; // by Narcle & mixster
+// * function ChangeWorld(W: Integer): Boolean; // by Nava2
+// * Procedure OrderWorlds(by: string; Descending: boolean); // by NaumanAkhlaQ
// * Function ChooseWorldBy(SettingsNames:TStringArray; SettingsDescending: TBooleanArray; Members, PVP: boolean): boolean; // by Rasta Magician
type
@@ -24,9 +24,9 @@
Prefix, Location, Activity, Language: String;
LootShare, QuickChat, PVP: Boolean;
end;
- TWorldArray = Array of TWorld;
+ TWorldArray = array of TWorld;
-Var
+var
WorldArray: TWorldArray;
WorldsOrdered: Boolean;
@@ -200,7 +200,6 @@
Description: Results true if the current world is members,returns world number.
World returns -1 if failed. Only works at world screen.
*******************************************************************************}
-
function WS_CurrentWorld(var World: Integer): Boolean;
var
P: TPoint;
@@ -365,7 +364,6 @@
by: Nava2
Description: Changes to world W. Returns True if successful.
*******************************************************************************}
-
function ChangeWorld(W: Integer): Boolean;
begin
while LoggedIn do ExitToLobby;
@@ -380,18 +378,18 @@
Check function for valid params of 'by'
Descending = true means the left button
*******************************************************************************}
-Procedure OrderWorlds(by: string; Descending: boolean);
+procedure OrderWorlds(by: string; Descending: boolean);
var
ATPA: T2DPointArray;
Arr: array of tstringarray;
TPA: TPointArray;
I: Byte;
TB: TBox;
-Begin
+begin
Arr := [TStringArray(['world', 'w', 'worlds']), TStringArray(['players', 'pl', 'player']), TStringArray(['activity', 'location', 'loc', 'act']),
TStringArray(['ls', 'lootshare']), TStringArray(['type', 't']), TStringArray(['ping', 'pi'])];
- For I := 0 To High(Arr) Do
- If InStrArr(Lowercase(By), Arr[i], False) Then
+ for I := 0 To High(Arr) do
+ if InStrArr(Lowercase(By), Arr[i], False) then
Break;
FindColorsTolerance(TPA, 1074576, 0, 0, 716, 141, 1);
ATPA := SplitTPA(TPA, 2);
@@ -407,7 +405,7 @@
Takes into account Members and PVP
Check OrderWorlds for valid params for SettingsNames
*******************************************************************************}
-Function ChooseWorldBy(SettingsNames:TStringArray; SettingsDescending: array of boolean; Members, PVP: boolean): boolean;
+function ChooseWorldBy(SettingsNames:TStringArray; SettingsDescending: array of boolean; Members, PVP: boolean): boolean;
var
TPA: TPointArray;
i, C : integer;
@@ -446,6 +444,7 @@
end;
end;
Result := false;
- writeln('Failed to sort the worlds. Choosing random world. Members: '+BoolToStr(Members)+'; PVP: '+BoolToStr(PVP)+';');
+ writeln('Failed to sort the worlds. Choosing random world. Members: ' +
+ BoolToStr(Members) + '; PVP: ' + BoolToStr(PVP) + ';');
SelectWorld(RandomWorld(Members, PVP));
-end;
\ No newline at end of file
+end;
Index: SRL/misc/Debug.scar
===================================================================
--- SRL/misc/Debug.scar (revision 421)
+++ SRL/misc/Debug.scar (working copy)
@@ -2,13 +2,13 @@
//-- Scar Standard Resource Library --//
//-- » Debug Routines --//
//-----------------------------------------------------------------//
-// * procedure TakeScreenshotEx(Path: string; X1, Y1, X2, Y2: Integer); // * by lordsaturn, small edit by Cazax & EvilChickcen!
-// * procedure TakeScreenshot(Path: String); // * by Nava2
-// * procedure DebugBitmap(Bmp: Integer);` // * by Cazax
-// * function DebugTPA(Points: TPointArray; BmpName: String): Boolean; // * by Wizzup?
-// * function DebugATPA(Points: TPointArray; BmpName: String): Boolean; // * by Wizzup?
-// * procedure DebugATPABounds(aPoints: Array Of TPointArray); // * by Wizzup?, lordsaturn, & caused
-// * procedure DebugColorArray(C: TIntegerArray); // * by Nava2
+// * procedure TakeScreenshotEx(Path: string; X1, Y1, X2, Y2: Integer); // by lordsaturn, Cazax, & EvilChickcen!
+// * procedure TakeScreenshot(Path: String); // by Nava2
+// * procedure DebugBitmap(Bmp: Integer);` // by Cazax
+// * function DebugTPA(Points: TPointArray; BmpName: String): Boolean; // by Wizzup?
+// * function DebugATPA(Points: TPointArray; BmpName: String): Boolean; // by Wizzup?
+// * procedure DebugATPABounds(aPoints: Array Of TPointArray); // by Wizzup?, lordsaturn, & caused
+// * procedure DebugColorArray(C: TIntegerArray); // by Nava2
{*******************************************************************************
procedure TakeScreenshotEx(Path: string; X1, Y1, X2, Y2 : Integer);
@@ -85,12 +85,12 @@
end;
{*******************************************************************************
-Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
+function DebugTPA(Points: TPointArray; BmpName: string): Boolean;
By: Wizzup?
Description: Shows an image of the Debug screen, plotting colors over the points
stored in Points TPA. If a name is specified, an image will be saved to that path.
*******************************************************************************}
-Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
+function DebugTPA(Points: TPointArray; BmpName: string): Boolean;
{$ifdef Simba}
var
Bmp,i : integer;
@@ -110,27 +110,26 @@
FreeBitmap(Bmp);
end;
{$else}
-Var
+var
Width, Height, ClientBMP, I, H: Integer;
xs, ys, xe, ye: Integer;
-
-Begin
- Try
- Begin
+begin
+ try
+ begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
H := High(Points);
- For I := 0 To H Do
- Begin
+ for I := 0 to H do
+ begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);
xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
- End;
+ end;
Width := xe - xs;
Height := ye - ys;
@@ -140,68 +139,66 @@
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
- For I := 0 To H Do
+ for I := 0 to H do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, clRed);
- If BmpName <> '' Then
+ if BmpName <> '' then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);
FreeBitmap(ClientBMP);
- End
- Except
+ end
+ except
FreeBitmap(ClientBMP);
- End;
+ end;
Result := True;
-End;
+end;
{$endif}
{*******************************************************************************
-Function DebugATPA(Points: TPointArray; BmpName: String): Boolean;
+function DebugATPA(aPoints: array of TPointArray; BmpName: string): Boolean;
By: Wizzup
Description: Shows an image of the client, plotting each TPA of the 2D point
array aPoints. Each TPA is a different color. If a name is
specified, an image will be saved.
*******************************************************************************}
-Function DebugATPA(aPoints: Array Of TPointArray; BmpName: String): Boolean;
-
-Var
+function DebugATPA(aPoints: array of TPointArray; BmpName: string): Boolean;
+var
Width, Height, ClientBMP, I, L, C, Col, h, hh: Integer;
xs, ys, xe, ye: Integer;
OuterPoints: TPointArray;
-
-Begin
+begin
H := High(aPoints);
- For I := 0 To H Do
+ for I := 0 to H do
L := L + Length(aPoints[i]);
SetLength(OuterPoints, L + 1);
C := 0;
- For I := 0 To H Do
+ for I := 0 to H do
begin
HH := High(aPoints[i]);
- For L := 0 To HH Do
- Begin
+ for L := 0 to HH do
+ begin
C := C + 1;
OuterPoints[C] := aPoints[i][L];
- End;
+ end;
end;
- Try
- Begin
+ try
+ begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
HH := High(OuterPoints);
- For I := 0 To HH Do
- Begin
+ for I := 0 to HH do
+ begin
xs := Min(xs, OuterPoints[i].X);
ys := Min(ys, OuterPoints[i].Y);
xe := Max(xe, OuterPoints[i].X);
ye := Max(ye, OuterPoints[i].Y);
- End;
+ end;
Width := xe - xs;
Height := ye - ys;
@@ -214,28 +211,28 @@
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye)
{$endif}
H := High(aPoints);
- For I := 0 To H Do
- Begin
+ for I := 0 to H do
+ begin
Col := Random(16777215);
HH := High(aPoints[i]);
- For L := 0 To HH Do
+ for L := 0 to HH do
FastSetPixel(ClientBMP, aPoints[i][L].X - xs, aPoints[i][L].Y - ys, Col);
- End;
+ end;
{$ifdef Simba}
DrawBitmapDebugImg(ClientBMP);
{$else}
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
{$endif}
- If BmpName <> '' Then
+ if BmpName <> '' then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
FreeBitmap(ClientBMP);
- End
- Except
+ end
+ except
FreeBitmap(ClientBMP);
- End;
+ end;
Result := True;
-End;
+end;
{*******************************************************************************
procedure DebugATPABounds(aPoints: Array Of TPointArray);
@@ -244,8 +241,7 @@
of different colour per TPA. If a name is specified, an image
will be saved.
*******************************************************************************}
-
-procedure DebugATPABounds(aPoints: Array Of TPointArray);
+procedure DebugATPABounds(aPoints: array Of TPointArray);
var
Width, Height, ClientBMP, I,x2, y2: Integer;
B: TBox;
2010-03-27 19:10:05