Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34

Thread: My approach at making simba produce more human like mouse movements

  1. #26
    Join Date
    Apr 2012
    Location
    UK
    Posts
    269
    Mentioned
    2 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by Shout View Post
    Any plans to post your modification?
    I am 230k away from getting the account to level 99 mining after I will post the full script for you guys to have a look at.

    Please thank Borland as its just a modified version of his script and keep your combined playing time to no more than 8 hours a day and you should be fine as this is a fresh account I used to get 99 mining.
    Last edited by tristen8878; 01-06-2018 at 12:51 AM.

  2. #27
    Join Date
    Apr 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Sounds great, I'd love to see your modifications.

  3. #28
    Join Date
    Apr 2012
    Location
    UK
    Posts
    269
    Mentioned
    2 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by Overdrive View Post
    Sounds great, I'd love to see your modifications.
    Code:
    program Iron_Ore_pro;   { Version: 2.3 }
    {$i AeroLib/AeroLib.Simba}
    
    const
      UseAntiBan     = True;  //Set True if you wish to use antiban (Highly recommended!!!)
      MinesOreAmount = 999999;  //How many ores to mine? 1 ore = 35 exp
      MouseStyle     = 1;      //0 = Accurate (straighter), 1 = Random line path
    
      MAX_MINE_TIME = 5400;    {Maximum time it takes for you to mine an ore
                                if it disappaers right as you start mining it lower
                                this value to 1800. If the script tries to mine another
                                rock before the current one is finished increase this
                                value by 1200 till that's no longer an issue.}
    type
      TExpLabel = Integer;
      TExperience = record
        Start, Last : TExpLabel;
        OreDropped  : TExpLabel;
        BeforeMining: TExpLabel;
      end;
    
      TOreInt = Integer;
      TOrePoint = TPoint;
      TOreTPA = TPointArray;
      TOreATPA = Array of TOreTPA;
      TOre = record
        tCol    : TColEx;
        ToDrop  : TOreInt;
        Failures: TOreInt;
        Dropping: Boolean;
    
        Point   : TOrePoint;
        MSPoints: TOreTPA;
        TPA     : TOreTPA;
        ATPA    : TOreATPA;
      end;
    
    var
      Experience: TExperience;
      Ore: TOre;
      Fails: Integer;
      timerProggy: Timer;
    
    const
      VERSION = 23;
    
    procedure ClassicMouse(x, y, ranx, rany: Integer);
    begin
      case MouseStyle of
        0: accurateMMouse(Point(x+Random(ranx), y+Random(rany)),0,0);
        1: humanmmouse(Point(x+Random(ranx), y+Random(rany)),0,0);
      end;
    end;
    
    function timerProggy.Ready: Boolean;
    begin
      Result := timerProggy.timeElapsed > 60000;
    end;
    
    function TExperience.Bar: Integer;
    begin
      Result := getXPBarAmount;
    end;
    
    procedure TExpLabel.setBar;
    begin
      Self := TExperience.Bar;
    end;
    
    function TExpLabel.BarDifference: Integer;
    begin
      Result := TExperience.Bar - Self;
    end;
    
    function TExpLabel.MoreThanBar: Boolean;
    begin
      Result := Self > Experience.Bar;
    end;
    
    function TExpLabel.LessThanBar: Boolean;
    begin
      Result := Self < Experience.Bar;
    end;
    
    function TExperience.Gained: Integer;
    begin
      Result := Experience.Start.BarDifference;
    end;
    
    function TExperience.PerHour: Integer;
    begin
      Result := Floor((Experience.Gained/((GetTimeRunning)/1000))*3600);
    end;
    
    procedure ReportLog;
    var
      h, m, s: Integer;
    begin
      if GetTimeRunning > 5000 then
      begin
        ConvertTime(GetTimeRunning, h, m, s);
        Writeln('---------------- Iron Ore Pro ----------------');
        Writeln('|  Script Has Run For : ',h,':',m,':',s);
        Writeln('|  Iron Ore Mined     : ',Experience.Gained/35);
        Writeln('|  Experience Gained  : ',Experience.Gained);
        Writeln('|  Experience Per Hour: ',Experience.PerHour);
        Writeln('--------------------- End --------------------');
      end;
    end;
    
    procedure StopScript(Reason: String);
    begin
      ReportLog;
      Writeln('====== '+(TheTime)+': Script stopped. Reason: '+Reason+' ======');
      logoutPlayer;
      TerminateScript;
    end;
    
    procedure TOreInt.Reset;
    begin
      Self := 1;
    end;
    
    function TOreInt.Present: Boolean;
    begin
      Result := itemInSlot(Self);
    end;
    
    function TOreInt.Present(Slot: Integer): Boolean; Overload;
    begin
      Result := itemInSlot(Slot);
    end;
    
    procedure TOreInt.Flip;
    begin
      Case Self of
        1: Self := 5;
        5: Self := 1;
      end;
    end;
    
    procedure TOreTPA.Clear;
    begin
      SetLength(Self, 0);
    end;
    
    procedure TOreATPA.Clear;
    begin
      SetLength(Self, 0);
    end;
    
    procedure TOre.Init();
    begin
      Self.tCol.create(1713728, 12, 0.12, 0.78);
      Self.ToDrop.Reset;
    end;
    
    function TOre.Find: Boolean;
    var
      TempATPA: T2DPointArray;
      i,ii,tmpCTS: Integer;
    begin
      Self.ATPA.Clear;
      Self.TPA.Clear;
    
      Self.tCol.findAllIn(AREA_MS, Ore.TPA);
      if Length(Ore.TPA) = 0 then
      begin
        Exit(False);
      end;
      Result := True;
    
      TempATPA := ClusterTPA(Self.TPA,12);
    
      for i := 0 to High(TempATPA) do
        if Length(TempATPA[i]) > 1000 then
          Self.ATPA := Self.ATPA + TempATPA[i];
    end;
    
    function TOreTPA.getPoint: TPoint;
    var
      RandomPoint, MidPoint: TPoint;
    begin
      if Length(Self) < 1 then
        Exit;
    
      MidPoint := MiddleTPA(Self);
      RandomPoint := Self[Random(0,High(Self))];
    
      case MidPoint.X > RandomPoint.X of
        True : RandomPoint.X := Random(RandomPoint.X, MidPoint.X)-Random(2);
        False: RandomPoint.X := Random(MidPoint.X, RandomPoint.X)+Random(2);
      end;
    
      case MidPoint.Y > RandomPoint.Y of
        True : RandomPoint.Y := Random(RandomPoint.Y, MidPoint.Y)-Random(2);
        False: RandomPoint.Y := Random(MidPoint.Y, RandomPoint.Y)+Random(2);
      end;
    
      Result := RandomPoint;
    end;
    
    procedure TOre.setMSPoints;
    var
      i: Integer;
    begin
      if Self.Find then
      begin
        SortATPASize(Self.ATPA, True);
        Self.MSPoints.Clear;
    
        for i := 0 to High(Ore.ATPA) do
          Self.MSPoints := Self.MSPoints + Self.ATPA[i].getPoint;
      end else
        Self.MSPoints.Clear;
    end;
    
    function Ore.Mined: Boolean;
    var
      Timerrr: Timer;
    begin
      Result := False;
      if isInvFull then
        Exit(True);
      Timerrr.start;
    
      repeat
        if Experience.BeforeMining.LessThanBar then
          Result := True
        else
          Wait(50+Random(50));
      until((Result) or (Timerrr.timeElapsed > MAX_MINE_TIME));
    
      if Result then
        Ore.Dropping := Ore.ToDrop.Present(5);
    
      Result := True;
    end;
    
    procedure Randombreak;
    begin
      case Random(1000) of
        889: Wait(Random(10,100));
        725..730: Wait(Random(10,800));
        555..565: Wait(Random(1000,2000));
      end;
    end;
    
    procedure RandomMouse;
    begin
      case Random(1000) of
        889: pickUpMouse();
        725..730: MMouseOffClient('random');
        555..565: pickUpMouse();
      end;
    end;
    
    procedure AntiBan;
    begin
      if not UseAntiBan then
        Exit;
      case Random(4000) of
        889: Wait(Random(800,3000));
        725..730: MMouseOffClient('random');
        555..565: Wait(Random(1000,40000));
      end;
    end;
    
    procedure itemuse;
    var
     pnt:Tpoint;
     begin
     if waitUpTextMulti(['->'],1) then
     begin
          pnt := [540, 223];
          HumanMMouse(pnt, 5, 5);
          fastClick(Mouse_Left);
          wait(random(1000, 2000));
          end else
          exit;
        end;
    
    procedure Ore.DropSingle(Slot: Integer);
    begin
      if not Ore.ToDrop.Present then
        Exit;
    
      mouseSpeed := random(25, 85);
      interactSlot(Slot, Mouse_Move);
      if waitUpTextMulti(['Iron',' ore','cut'],1200) then
      begin
        Antiban;
        Randombreak;
        Wait(Random(5,210));
        KeyDown(VK_SHIFT);
        Randombreak;
        Wait(Random(5,300));
        fastClick(Mouse_Left);
        Wait(Random(1,120));
        KeyUp(VK_SHIFT);
        Antiban;
        RandomMouse;
        sleepAndMoveMouse(100 + random(500));
        //Ore.ToDrop.Reset;
      end;
    end;
    
    procedure Ore.Drop;
    begin
      if not Ore.ToDrop.Present then
      begin
        while(not(Ore.Mined)) do
          Wait(10+Random(10));
        Exit;
      end;
      Ore.Dropping := Ore.ToDrop.Present(5);
    
      interactSlot(Ore.ToDrop, Mouse_Move);
    
      if waitUpTextMulti(['Iron',' ore','cut'],1200) then
      begin
      antiban;
        while(not(Ore.Mined)) do
          Wait(10+Random(10));
    
        if (Ore.Dropping) and (Experience.OreDropped.LessThanBar) then
        begin
          Ore.DropSingle(Ore.ToDrop);
          Ore.ToDrop.Flip;
          Experience.OreDropped.setBar;
          Ore.Failures := 0;
        end;
      end else
        if itemInSlot(Ore.ToDrop) then
          //StopScript('Move unknown item from slots 1 & 5 inventory');
    end;
    
    function Ore.Mine: Boolean;
    var
      i, RanI: Integer;
      OrePoints: TPointArray;
      RandomOrePoint: TPoint;
    begin
      Result := False;
      Ore.Dropping := Ore.ToDrop.Present(5);
      Ore.setMSPoints;
      OrePoints := Ore.MSPoints;
    
      if Length(OrePoints) > 0 then
      begin
      antiban;
        for i := 0 to High(OrePoints) do
        begin
          RanI := I+(Random(High(OrePoints)-I));
          RandomOrePoint := OrePoints[Rani];
    
          mouseSpeed := random(25, 85);
          ClassicMouse(RandomOrePoint.x-1, RandomOrePoint.y-1, 3, 3);
          Wait(Random(100,180));
          itemuse;
          if waitUpTextMulti(['Mine','ine R', ' ocks'],600) then
          begin
            Antiban;
            Experience.BeforeMining.setBar;
            fastClick(Mouse_Left);
            Wait(Random(1,100));
            Antiban;
            RandomMouse;
            sleepAndMoveMouse(100 + random(500));
            Exit(True);
          end else
          begin
            Inc(Ore.Failures);
            Ore.setMSPoints;
            OrePoints := Ore.MSPoints;
          end;
        end;
      end else
        if Ore.Failures > 30 then
          StopScript('Failed to find ores after 30 tries.');
    end;
    
    procedure Checks;
    begin
    
      Antiban;
    
      if not isLoggedIn then
        StopScript('We are not logged in');
    
      if Experience.Start.BarDifference / 35 >= MinesOreAmount then
        StopScript('Mined desired number of iron ore');
    
      if Fails >= 15 then
        StopScript('Too many failures detetcted');
    
      if timerProggy.Ready then
      begin
        ReportLog;
        if Experience.Last >= Experience.Bar then
          //StopScript('We have not gained any experience in a whole minute.')
        else
          Experience.Last.setBar;
    
        timerProggy.start;
      end;
    end;
    
    procedure SetupScript;
    begin
      initAL;
      mouseSpeed := 30;
      ActivateClient;
      if not isLoggedIn then
        StopScript('We are not logged in');
    
      timerProggy.start;
      Experience.Start.setBar;
      Experience.Last := Experience.Start;
      Experience.OreDropped := Experience.Start;
    
      Ore.Init;
      Ore.setMSPoints;
    
      while not isInvFull do
        if Ore.Mine then
          while(not(Ore.Mined)) do
            Wait(Random(125,250));
    
      if isInvFull then
        Ore.DropSingle(5);
    
    end;
    
    begin
      SetupScript;
    
      repeat
        if clickContinueEx(False) then
          Ore.DropSingle(5);
    
        if Ore.Mine then
          Ore.Drop;
    
        Checks;
      until(False);
    
    end.

  4. #29
    Join Date
    Jan 2018
    Location
    Sweden
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I'm trying to write a tin miner and I'm reading through this code to learn. I got a question regarding a function.
    When trying to run this I get this error: Error: Variable expected at line 68, which refers to this:

    Code:
    procedure TExpLabel.setBar;
    begin
    
      Self := TExperience.Bar;
    end;
    The bar function looks like this:

    Code:
    function TExperience.Bar: Integer;
    begin
      Result := getXPBarAmount;
    end;

    I tried substituting Self := TExperience.Bar; with Self := getXPBarAmount and then it works.

    I guess that achieves the same thing but I'm curious as to why the bar function isn't working for me?

  5. #30
    Join Date
    Jan 2018
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Would be nice if you could tell us the requirements like simba 1200 or 1100 and whatnot I can't get this running at all.

  6. #31
    Join Date
    Jul 2014
    Posts
    125
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by icyxen View Post
    Would be nice if you could tell us the requirements like simba 1200 or 1100 and whatnot I can't get this running at all.
    You need the Aerolib include, also you can auto-update SRL from Simba itself, that is one of the first things the tutorials for setting up Simba do so check there on how to do so:

    https://villavu.com/forum/showthread.php?t=107436

  7. #32
    Join Date
    Aug 2012
    Posts
    188
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    If you are really concerned about human-like mouse clicks and the delay between them, I would suggest a Gaussian Distribution instead of completely random. If you do a repetitive task clicking inside a box, you probably are going to be clicking around a certain point instead of randomly through out the box. Therefore, if you generate a random point from a distribution, it would probably appear more human.

    8ff132ca43.png

    EDIT: I looked in the Aerolib source and if you're interested there's a function in Math that will give you a point normally distributed from the center.
    Simba Code:
    procedure GaussBox(out px, py: Integer; x1, y1, x2, y2: Integer);

  8. #33
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Quote Originally Posted by Swag Bag View Post
    I would suggest a Gaussian Distribution instead of completely random.
    Fairly certain SRL has done this for years. Not even sure it ever even used a Uniform or Binary distribution for the mouse.

  9. #34
    Join Date
    Aug 2012
    Posts
    188
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    You're right! I just went through the github and found that the default move function uses:
    Simba Code:
    Round((max+min)/2.0 + TruncatedGauss(0, (max-min)/2, CUTOFF));

    It would be interesting to use a different distribution for different situations, like moving the mouse from the left or right side to click, or a higher variance the longer you play, but I doubt jamflex employs statisticians to aggregate clicking data to identify weird distributions!

Page 2 of 2 FirstFirst 12

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
  •