Results 1 to 5 of 5

Thread: libSRL5

  1. #1
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default libSRL5

    Made this small include to aid me in porting some scripts over from SRL 5 to SRL 6. It is absolutely NOT recommended to use this for any other purpose except for saving you a lot of headaches crtl-r'ing lots of stuff. It also adds some overloaded methods for changed Simba functions.
    Basically few steps left after importing this include:
    • CTS settings are gone, but you can supply them with the parameter colorSetting in FindColorsTolerance
    • TDTM -> TSDTM
    • Bankscreen/Pinscreen -> bankscreen/pinscreen.isOpen
    • Please fix the gametabs yourself etc.
    • Players.active -> isActive, .loc -> .location
    • And some more!



    Enjoy.

    - Markus

    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;
    I made a new script, check it out!.

  2. #2
    Join Date
    Feb 2013
    Location
    Rimmington
    Posts
    319
    Mentioned
    33 Post(s)
    Quoted
    183 Post(s)

    Default

    //sorry but else my essminer doesnt work as it NEEDS these to be constants

    I like!

  3. #3
    Join Date
    Aug 2014
    Location
    Australia
    Posts
    932
    Mentioned
    53 Post(s)
    Quoted
    495 Post(s)

    Default

    Quote Originally Posted by Markus View Post
    //Copied from The Mayor's miner
    //I have no idea what kind of randoms there are nowadays..
    I'm not sure if you've been told yet, but RS3 has no randoms, and quite soon OSRS (Oldschool RuneScape, a 2007 copy of the game with minor updates). This has made botting a lot easier. The "randoms" dealt with in that function are just the micro-transaction related crap that Jagex has introduced into the game. That includes the "treasure" game thing which pops up in the top left when you log in (and is closed by exitTreasure) which replaced the previous spin thingy which used spin tickets (which claimTickets deals with if one exists in your inventory).

    Hope that explained a few things.

    As for your include, I have literally no use for it, but I'm glad to see an old timer returning and being active.



    New to scripting? Procedures & Functions for Beginners
    Do you use your computer at night? Just get f.lux

  4. #4
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Yea I've heard something about randoms being removed. I'm curious why they'd remove them in OSR though. They shouldn't pose a problem at all for SRL, as around 2008ish we literally had every random fully solved with colour, even the maze and prison pete! Candlelight was an exception though but that one was really really rare. Just grab an old version from the SVN
    I made a new script, check it out!.

  5. #5
    Join Date
    Jan 2014
    Location
    New Found Land
    Posts
    108
    Mentioned
    3 Post(s)
    Quoted
    21 Post(s)

    Default

    they probably just want more money of course lol

    "When all government, domestic and foreign, in little as in great things, shall be drawn to Washington as the center of all power, it will render powerless the checks provided of one government on another, and will become as venal and oppressive as the government from which we separated."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •