Skip to content

Commit

Permalink
Push SRL 5 code as a starting point
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Hobbs committed Feb 28, 2013
1 parent af6b78a commit 4beff61
Show file tree
Hide file tree
Showing 105 changed files with 55,303 additions and 0 deletions.
11 changes: 11 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Benjamin Land
Cohen Adair
Kevin Brightwell
Mark Janse
Merlijn Wajer
Niels AD
Axel Schmidt Selmer-Anderssen
Colby Nagle
Chris Hobbs
David Mendes
Nathan Hartung
674 changes: 674 additions & 0 deletions COPYING.txt

Large diffs are not rendered by default.

File renamed without changes.
229 changes: 229 additions & 0 deletions SRL.simba
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
//----------------------------------------------------------------------------//
//-- SRL Resource Library --//
//----------------------------------------------------------------------------//
//-- by: Azeroth, Bebe, BenLand100, benleegt, Boreas, c0de, Cheesehunk --//
//-- Coh3n, dakota, Dankness, driger1592, EvilChicken!, Flyboy, --//
//-- Freddy1990, Hobbit, IceFire908, inferno, Kernel Klink, Knightstreak, --//
//-- Krazy_Meerkat, Krichevskoy, Liquid, Lorax, lordsaturn, Mad Cow, --//
//-- marpis, Markus, masquerader, mastaraymond, moparisthebest, --//
//-- Mutant Squirrle, n3ss3s, N1ke, Naum, Nava2, NCDS, nielsie95, --//
//-- phantombmx, pups, Pyro, RAM, Rasta Magician, realrune, Renax, Ron, --//
//-- RsN, SKy Scripter, solemn wishes, Spky, SRL, Starblaster100, --//
//-- Stupid3ooo,Sumilion, tarajunky, The Claw, The_Rs_Monkey, TRiLeZ, --//
//-- Wizzup?, WT-Fakawi, XxKanexX, Yakman, YoHoJo, ZephyrsFury, _ChArMz, --//
//-- --//
//-- ....... and the SRL Community. --//
//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//
//-- SRL Level 1 Includes --//
//-- --//
//-- Low Level SCAR Math, Mouse Movement and Color routines. --//
//----------------------------------------------------------------------------//

// For development:
//{$DEFINE CompileSRL}

{$DEFINE SRL5}

{$IFDEF Lape}
{$include SRLLape.simba}
{$ENDIF}

{$IFDEF SMART8}
{$IFNDEF SMART}
{$DEFINE SMART}
{$ENDIF}
{$ENDIF}

{$IFDEF SMART}
{$IFNDEF SRL_SMART}
{$IFDEF SIMBAMAJOR980}
{$I SRL/SRL/Misc/Smart.Simba}
{$ELSE}
Procedure ActivateClient; {$IFDEF LAPE}override;{$ENDIF} begin end;
{$ENDIF}
{$ENDIF}
{$ENDIF}

//{$include SRL/SRL/core/defines.simba}
{$ifdef Simba}
{$i SRL/SRL/core/simba.simba}
{$endif}
{$include SRL/SRL/core/globals.simba}
{$include SRL/SRL/core/math.simba}
{$include SRL/SRL/core/mouse.simba}
{$include SRL/SRL/core/color.simba}
{$include SRL/SRL/core/players.simba}

//----------------------------------------------------------------------------//
//-- SRL Level 2 Includes --//
//-- --//
//-- Interface and OCR routines. --//
//----------------------------------------------------------------------------//

{$include SRL/SRL/core/text.simba}
{$include SRL/SRL/core/timing.simba}
{$include SRL/SRL/core/SRLlog.simba}
{$include SRL/SRL/core/chat.simba}
{$include SRL/SRL/core/bitmaps.simba}
{$include SRL/SRL/core/amount.simba}
{$include SRL/SRL/core/gametab.simba}

//----------------------------------------------------------------------------//
//-- SRL Level 3 Includes --//
//-- --//
//-- MapWalking, AntiRandoms, Objects, Bank, Symbol and many more... --//
//----------------------------------------------------------------------------//

{$include SRL/SRL/core/animation.simba}
{$include SRL/SRL/core/flag.simba}
{$include SRL/SRL/core/worldswitcher.simba}
{$include SRL/SRL/core/login.simba}
{$include SRL/SRL/core/autocolor.simba}
{$include SRL/SRL/core/mapwalk.simba}
{$include SRL/SRL/core/object.simba}
{$include SRL/SRL/core/inventory.simba}
{$include SRL/SRL/core/bank.simba}
{$include SRL/SRL/core/symbol.simba}
{$include SRL/SRL/core/rc.simba}
{$include SRL/SRL/core/cautorespond.simba}
{$include SRL/SRL/core/antiban.simba}
{$include SRL/SRL/core/globalstats.simba}

{$include SRL/SRL/core/antirandoms/antirandoms.simba}

{$IFDEF LoadExtraFonts}
{$include SRL/SRL/misc/fontupdater.simba}
{$ENDIF}

{$IFNDEF SIMBAMAJOR980}
{$IFDEF SMART}
{$IFNDEF SRL_SMART}
{$include SRL/SRL/misc/SmartParams.Simba}
{$ENDIF}
{$ENDIF}
{$ENDIF}

{$DEFINE SRL_OPENDEV}
{*******************************************************************************
procedure FreeSRL;
by: SRL Dev Team
Description: Tries to free all the variables it allocated during runtime.
*******************************************************************************}
procedure FreeSRL;
begin
FreeSRLBitmaps;
FreeSRLFonts;
end;

{*******************************************************************************
procedure SetupSRL;
by: SRL Dev Team
Last Edit: 22 June 2010 -- Nava2
Description: Sets up all variables needed to run SRL.
*******************************************************************************}

procedure SetupSRL;
var
t: Integer;
begin
{$IFNDEF SMART}
{$IFDEF SIMBA}
if (not IsTargetValid) then
srl_Warn('SetUpSRL', 'Target client is not valid! ' +
'Drag the crosshairs over the target client.', warn_Terminate);
{$ENDIF}
{$ENDIF}
SetupBoxes; //Sets up box variables in globals.simba
t := GetTimeRunning;
MouseSpeed := 15;
{$IFDEF UseLaptopMouse}LMouse_MissChance := 75;{$ENDIF}
CheckHPFirst := True;
Reincarnate := False;
TalkAfterRandoms := False;
RoadColor := 0;
WaterColor := 0;
BankColor := 0;

// these need to be removed eventually (no longer used)
SRL_OnFindRandomCall := nil;
LampSkill := 'mining';

//SetUpSRLReport;
LoadCosineArrays;
SymbolAccuracy:= 0.8;
LoadSRLBitMaps;
LoadSRLFonts;
{$IFNDEF SRL_RANDOMS_TEST}
_SetRandoms();
{$ENDIF}
SetupSRLAutoResponder;
SRL_RandomScreenShot := False;
UseFindMod := True;
LogoutOnMod := True;
UseFindTrade := True;
UseAutoResponder := True;
GraphicsSet := False;
AllowPVP := False;
SRL_DisableIPLog := false;
SRL_SavePath := includePath + 'SRL/logs/';
SRL_StartTime := theDate(DATE_MONTH)+' at '+theTime;
WarnSensitivity := -2;
SetupAutoColors;

{$IFDEF LoadExtraFonts}
srl_UpdateFonts(srl_FontsUp2date);
{$ENDIF}

AddOnTerminate('FreeSRL');
SetSupressExceptions(true);
Writeln ('SRL Compiled in '+ IntToStr(GetTimeRunning - t) + ' msec');

{$IFDEF SRL_SMART}
{$IFDEF SIMBAMAJOR980}
if (Smart_Server = 0) then
begin
Smart_Server := RandomWorld(Smart_Members, False);
Smart_Signed := True;
Smart_SuperDetail := False;
end;
Writeln('SMART Initialized.' + #10 + 'Loaded: Server ' + IntToStr(Smart_Server) + ', Members: ' + BoolToStr(Smart_Members)
+ ', Signed: ' + BoolToStr(Smart_Signed) + ', Super Detail: ' + BoolToStr(Smart_SuperDetail) + '.');
SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
SetTargetArray(SmartImageArray, 765, 553);
{$ELSE}
SetupSmart(Smart_ForceNew);
if (SRL_SixHourFix) then
SRL_Procs[srl_OnRSUpdate] := @SixHourFix;
{$ENDIF}

repeat
{$IFNDEF SIMBAMAJOR980}
{$IFDEF SMART}
If Smart_FixSpeed then
FixSmartSpeed;
{$ENDIF}
{$ENDIF}
Wait(100);
if (GetTimeRunning - t) > 120000 then
Break;
until(RSReady);
{$ENDIF}

SetupGauss;
SRL_ResetNavBar;
Proc_WorldSwitcherEnabled
end;

{$ifdef CompileSRL}
begin
SetupSRL;
end.
{$endif}

{$ifdef LAPE}
begin
SetupSRL;
end.
{$endif}
145 changes: 145 additions & 0 deletions SRL/core/SRLlog.simba
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
(*

SRL Debug Log
=============

Routines that write to the SRL log file.

.. contents::

*)

var
SRL_SavePath: string; // the path to save log files
SRL_StartTime: string; // the time the script starts (used to name log file)
SRL_DisableLogging: boolean; // gives the scripter the option to disable

(*
TakeScreen
~~~~~~~~~~

.. code-block:: pascal

procedure TakeScreen(Reason: string);

Sets up Box variables

.. note::

by Mutant, Squirrle, Yakman, & Harry
Last Modified: Feb. 16th, 2012 by Coh3n

Example:

.. code-block:: pascal

TakeScreen('Prison Pete');

*)
procedure TakeScreen(Reason: string);
begin
if (not DirectoryExists(SRL_SavePath)) then
ForceDirectories(SRL_SavePath);

try
if FileExists(SRL_SavePath + reason + ' ' + Players[CurrentPlayer].Name + '.png') then
SaveScreenshot(SRL_SavePath + reason + ' ' + Players[CurrentPlayer].Name + ' ' + TimeRunning + '.png')
else
SaveScreenshot(SRL_SavePath + reason + ' ' + Players[CurrentPlayer].Name + '.png');

WriteLn('Screenshot of: ' + reason + ' ' + TimeRunning);
except
Writeln('Failed to save screenshot of: ' + reason);
end
end;

(*
OpenSRLLogFile
~~~~~~~~~~~~~~

.. code-block:: pascal

function OpenSRLLogFile(): integer;

Creates the SRL log file.

.. note::

by Coh3n
Last Modified: Feb. 20th, 2012 by Coh3n

Example:

.. code-block:: pascal

OpenSRLLogFile();

*)
function OpenSRLLogFile(): integer;
var
fileName: string;
begin
if (SRL_DisableLogging) then
exit;

if (not directoryExists(SRL_SavePath)) then
forceDirectories(SRL_SavePath);

// make sure it's a valid file name (Windows)
fileName := 'SRL log ('+SRL_StartTime+').txt';
fileName := replace(fileName, '/', '-');
fileName := replace(fileName, ':', ' ');
fileName := SRL_SavePath + fileName;

try
if (fileExists(fileName)) then
result := appendFile(fileName)
else
result := createFile(fileName);
except
writeln('OpenSRLLogFile: '+exceptionToString(exceptionType, exceptionParam));
end;
end;

(*
AddToSRLLog
~~~~~~~~~~~

.. code-block:: pascal

procedure AddToSRLLog(s : string);

Writes the string 's' to the SRL log file.

.. note::

by Markus
Last Modified: Feb. 20th, 2012 by Coh3n

Example:

.. code-block:: pascal

AddToSRLLoc('Adding to SRL log file!');

*)
procedure AddToSRLLog(s: string);
var
tmpFile: integer;
begin
writeln(s);

if (SRL_DisableLogging) then
exit;

tmpFile := openSRLLogFile();

if (tmpFile >= 0) then
try
writeFileString(tmpFile, '['+msToTime(getTimeRunning(), TIME_BARE)+']: '+s+#13+#10);
except
SRL_Warn('AddToSRLLog', 'Could not write to logfile: '+exceptionToString(exceptionType, exceptionParam), WARN_ALLVERSIONS);
finally
closeFile(tmpFile);
end;
end;
Loading

0 comments on commit 4beff61

Please sign in to comment.