Simba Code:
{ SRL 5 compatibility library for use with SRL 6. For updating legacy scripts }
var
{mmx1, mmx2, mmy1, mmy2, }msx1, msy1, msx2, msy2, mmcx, mmcy, mscx, mscy,
clickLeft, clickRight, __angle_i : integer;
var
SineArray, Cosearray: array[0..360] of Extended;
pi_const : extended;
function FindNormalRandoms : boolean; //Copied from The Mayor's miner ;)
begin //I have no idea what kind of randoms there are nowadays..
exitTreasure();
claimTicket();
result := false;
end;
procedure FFlag(dist : integer);
begin
minimap.waitFlag(dist); //cbf to rewrite 90% of the script
end;
procedure MMouse(x, y, randomx, randomy : integer);
begin
Mouse(x, y, randomx, randomy, mouse_move);
end;
Procedure FNRWait(ms: Integer);
Var
T: Integer;
Begin
T := GetSystemTime;
While GetSystemTime - T < ms Do
Begin
Wait(200);
FindNormalRandoms;
End;
End;
function IntToPoint(const px, py : integer) : tpoint;
begin
result.x := px;
result.y := py;
end;
procedure SortATPAFrom(var a: T2DPointArray; const fx, fy : integer); overload;
begin
SortATPAFrom(a, IntToPoint(fx, fy));
end;
function GetUpText : string; //I hope UpText is MouseOverText..
begin
result := getMouseOverText;
end;
function WaitUpTextMulti(text : TStringArray; waittime : integer) : boolean;
begin
result := isMouseOverText(text, waittime);
end;
procedure ClickMouse2(left : boolean);
begin
if left then
fastClick(mouse_left)
else
fastclick(mouse_right);
end;
function WaitOptionEx(action1, action2 : string; clickit, waittime : integer) : boolean;
begin
result := chooseOption.select([action1, action2], waittime);
end;
function IsUptext(str : string) : boolean;
begin
result := isMouseOverText([str]);
end;
function isFlagPresent : boolean;
begin
result := minimap.isFlagPresent;
end;
function MouseFlagEx(X, Y, rX, rY, Xmod, Ymod, FlagDist: Integer; //copied from srl 5.
CheckForFlag, CheckForRoadColor: Boolean): Boolean;
var
I: Integer;
P: TPoint;
begin
Result := False;
if (minimap.isFlagPresent) then
if (CheckForFlag) or (minimap.getFlagDistance <= FlagDist) then exit;
P := Point(X - Xmod, Y - Ymod);
Xmod := Max(Xmod, 3);
Ymod := Max(Ymod, 3);
for I := 0 to 4 do
begin
IncEx(P.X, Xmod + Random(rX));
IncEx(P.Y, Ymod + Random(rY));
if not pointInBox(P, minimap.GetBounds) then Continue;
Mouse(P.X, P.Y, 0, 0, mouse_left);
Result := WaitFunc(@isFlagPresent, 50, 3000);
if (Result) then break;
end;
if (FlagDist > -1) then
minimap.waitFlag(FlagDist);
end;
function MFF(X, Y, Xmod, Ymod: Integer): Boolean;
begin
Result := MouseFlagEx(X, Y, 3, 3, Xmod, Ymod, -1, True, False);
end;
function FindSymbol(var x, y : integer; symbolnumber : integer) : boolean; //Small change, not backwards compatible
var
p : tpoint;
begin
result := minimap.findSymbol(p, symbolnumber, minimap.getbounds());
x := p.x;
y := p.y;
end;
function InvCount : integer;
begin
result := tabBackpack.count;
end;
procedure LogOut;
begin
players[currentPlayer].logout();
end;
procedure Deposit(startslot, endslot : integer; depositall : boolean);
var
i : integer;
bleuh : tintegerarray;
begin
setlength(bleuh, endslot-startslot+1);
for i := startslot to endslot do
bleuh[i-startslot] := i;
bankscreen.deposit(bleuh, [], not depositall);
end;
procedure CloseBank;
begin
bankscreen.close();
end;
function InvFull : boolean;
begin
result := tabbackpack.isFull;
end;
procedure SetRun(run : boolean);
begin
minimap.toggleRun(run);
end;
function MFNF(X, Y, Xmod, Ymod: Integer): Boolean;
begin
Result := MouseFlagEx(X, Y, 3, 3, Xmod, Ymod, -1, False, False);
end;
procedure MakeCompass(direction : string);
begin
case lowercase(direction) of
'n': minimap.setAngle(MM_DIRECTION_NORTH);
'e': minimap.setAngle(MM_DIRECTION_EAST);
's': minimap.setAngle(MM_DIRECTION_SOUTH);
'w': minimap.setAngle(MM_DIRECTION_WEST);
end;
end;
procedure LoginPlayer;
begin
players[currentplayer].login;
end;
function loggedin : boolean;
begin
result := isLoggedIn;
end;
function IsUpTextMultiCustom(text : tstringarray) : boolean;
begin
result := isMouseOverText(text);
end;
function ChooseOptionMulti(text : tstringarray) : boolean;
begin
result := chooseoption.select(text);
end;
function Cose(Degrees: Integer): Extended;
begin
Result := cosearray[Trunc(FixD(Degrees))];
end;
function Sine(Degrees: Integer): Extended;
begin
Result := sinearray[Trunc(FixD(Degrees))];
end;
procedure SRLRandomsReport;
begin
writeln('Thank your for using the SRL-5 compatibility library!');
end;
function CreateTPAFromText(Txt: string; Chars: string) : TPointArray;
var
w,h : integer;
begin;
result := TPAFromText(Txt,Chars,w,h);
end;
procedure NextPlayer(active : boolean);
begin
players.next(active);
end;
function FindColorsTolerance(var pts: TPointArray; col, x1, y1, x2, y2, tol: Integer; setts : tcolorsettings): Boolean; overload;
begin
result := findcolorstolerance(pts, col, inttobox(x1, y1, x2, y2), tol, setts);
end;
procedure Mouse(x, y, rx, ry : integer; left : boolean); overload;
var
clickityclick : integer;
begin
if left then
clickityclick := MOUSE_LEFT
else
clickityclick := MOUSE_RIGHT;
Mouse(x, y, rx, ry, clickityclick);
end;
const //sorry but else my essminer doesnt work as it NEEDS these to be constants
mmx1 = 577;
mmy1 = 12;
mmx2 = 798;
mmy2 = 200;
begin
msx1 := mainscreen.getbounds.x1;
msy1 := mainscreen.getbounds.y1;
msx2 := mainscreen.getbounds.x2;
msy2 := mainscreen.getbounds.y2;
{mmx1 := minimap.getbounds.x1;
mmy1 := minimap.getbounds.y1;
mmx2 := minimap.getbounds.x2;
mmy2 := minimap.getbounds.y2;}
mmcx := minimap.getcenterpoint.x;
mmcy := minimap.getcenterpoint.y;
mscx := mainscreen.getcenterpoint.x;
mscy := mainscreen.getcenterpoint.y;
clickLeft := MOUSE_LEFT;
clickRight := MOUSE_RIGHT;
pi_const := Pi; // not necessary, but might as well.
for __angle_i := 0 to 360 do
begin
Sinearray[__angle_i] := Sin(__angle_i * pi_const / 180.0);
Cosearray[__angle_i] := Cos(__angle_i * pi_const / 180.0);
end;
end;