Results 1 to 8 of 8

Thread: Wooohhhh, a new script that I'm gonna be working on (Monkfisher)

  1. #1
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default Wooohhhh, a new script that I'm gonna be working on (Monkfisher)

    Hey all, I thought I would put together a very quick (and shit) monkfisher for my ironman. It is VERY basic and could use quite a bit of help from the community. I have put a bunch of notes at the main loop so that you know what each procedure needs a look at. I hope that I can get some help with this. I also hope that me attempting to make a script, will push people to bring out their scripts that they are attempting to make.

    Code:
    program IronManMonkFish;
    
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'username';
        password := 'password';
        world := -1;
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;
    
    procedure WalkToFishingSpot ();
    var
      FishArea: TPoint;
    begin
      FishArea := [[147, 11], [198, 9], [195, 41], [152, 41]];
    
      repeat
        writeLn('Found fishing spot: ', sps.isInPolygon(FishArea));
        wait(1000);
      until false;
    
    end;
    
    procedure CatchingFish();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    
    begin
      if not isLoggedIn() then
        exit;
    
      repeat
    
      findColorsSpiralTolerance(x, y, TPA, 12295040, mainScreen.getBounds(), 22, colorSetting(2, 0.06, 0.60));
    
      if (Length(TPA) < 1) then
        exit;
    
      ATPA := TPA.toATPA(30, 30);
      ATPA.filterBetween(0, 10);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);
    
      for i := 0 to high(ATPA) do
      begin
        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        if isMouseOverText(['ishing', 'pot'], 500) then
        begin
          fastClick(MOUSE_LEFT);
          smartImage.clear;
          break;
        end;
      end;
    
      tabBackpack.waitForShift(300000);
    
      until tabBackpack.isFull()
    
    end;
    
    procedure WalkToBank();
    var
      BankArea: TPoint;
    begin
      minimap.findSymbol(BankArea, MM_SYMBOL_BANK, minimap.getBounds());
    
      mouse(BankArea,MOUSE_LEFT);
      minimap.waitPlayerMoving()
    end;
    
    procedure FindBanker();
    var
      x, y, i: integer;
    begin
      if not isLoggedIn() then
        exit;
    
      repeat
        mainscreen.findObject(x, y, 5279160, 8 , colorSetting(2, 0.32, 1.37), mainscreen.playerPoint, 10, 50, 20, ['ank', 'rnold', 'ydspor'], MOUSE_LEFT);
        wait(randomRange(1000, 2000));
    
        inc(i);
      until BankScreen.isOpen() or (i >= 15);
    end;
    
    procedure BankFish ();
    begin
      if bankScreen.isOpen(5000) then
          bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
          wait(randomRange(1000, 2000));
          bankScreen.close();
    
    
      exit;
    
    end;
    
    
    // main loop
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
    
      sps.setup('MONKFISH_MAP', RUNESCAPE_OTHER);
    
      repeat
        if not isLoggedIn() then
        begin
          players[currentPlayer].login();
          exitTreasure();
          minimap.setAngle(MM_DIRECTION_NORTH);
          mainScreen.setAngle(MS_ANGLE_HIGH);
        end;
    
    
        begin
        //WalkToFishingSpot();               // I tried to use SPS tookbox to create an area to where I hoped the mouse would go to, but it doesn't seem to work
        //CatchingFish();                    // almost complete, however I'm attempting to make it only look for another fishing spot once my characters animation stops moving. I have looked in the SRL, but it's still a bit confusing to me lol
        //if tabBackpack.isFull() then       //~ Actually can't remmeber where I was going with this one, as I have not made a method for this xD
        // WalkToBank();                     //complete, this walks straight to tha bank icon as inteneded. If there is anything else that might improve it then do tell.
        // FindBanker();                    //complete, this finds the banker, but with very few colours. I'm trying to make this fulkly cvolour, Don't want to add any oglib (wanna practice the long route first)
        // BankFish();                      // Okay, so it banks the fish by the quick depoisit.. EASY..... BUT OMFG...... I can not for the life of me find out how to close the bank without manually creating a t-box for the 'x' button. I know there is an easy piece of code that will allow me to just press the ESC key, or close out of it. (again checked the SRL.. but still confusing.
        end;
        until(false);
        end.
    
        // LASTLY..... I am aware that there is no antiban, very few 'randomrange' waits etc..... I just wanna get the basics done first. All help is welcome, and EVEN better if anyone wants to private message me and give me some more pointers you would be awesome.

  2. #2
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by nero_dante View Post
    Hey all, I thought I would put together a very quick (and shit) monkfisher for my ironman. It is VERY basic and could use quite a bit of help from the community. I have put a bunch of notes at the main loop so that you know what each procedure needs a look at. I hope that I can get some help with this. I also hope that me attempting to make a script, will push people to bring out their scripts that they are attempting to make.

    Code:
    program IronManMonkFish;
    
    {$DEFINE SMART}              // Always have this to load smart
    {$I SRL-6/SRL.simba}         // To load the SRL include files
    {$I SPS/lib/SPS-RS3.Simba}   // To load the SPS include files
    
    procedure declarePlayers();
    begin
      setLength(players, 1);
      with players[0] do
      begin
        loginName := 'username';
        password := 'password';
        world := -1;
        isActive := true;
        isMember := true;
      end
      currentPlayer := 0;
    end;
    
    procedure WalkToFishingSpot ();
    var
      FishArea: TPoint;
    begin
      FishArea := [[147, 11], [198, 9], [195, 41], [152, 41]];
    
      repeat
        writeLn('Found fishing spot: ', sps.isInPolygon(FishArea));
        wait(1000);
      until false;
    
    end;
    
    procedure CatchingFish();
    var
      x, y, i: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    
    begin
      if not isLoggedIn() then
        exit;
    
      repeat
    
      findColorsSpiralTolerance(x, y, TPA, 12295040, mainScreen.getBounds(), 22, colorSetting(2, 0.06, 0.60));
    
      if (Length(TPA) < 1) then
        exit;
    
      ATPA := TPA.toATPA(30, 30);
      ATPA.filterBetween(0, 10);
      ATPA.sortFromMidPoint(mainscreen.playerPoint);
      smartImage.debugATPA(ATPA);
    
      for i := 0 to high(ATPA) do
      begin
        mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
        if isMouseOverText(['ishing', 'pot'], 500) then
        begin
          fastClick(MOUSE_LEFT);
          smartImage.clear;
          break;
        end;
      end;
    
      tabBackpack.waitForShift(300000);
    
      until tabBackpack.isFull()
    
    end;
    
    procedure WalkToBank();
    var
      BankArea: TPoint;
    begin
      minimap.findSymbol(BankArea, MM_SYMBOL_BANK, minimap.getBounds());
    
      mouse(BankArea,MOUSE_LEFT);
      minimap.waitPlayerMoving()
    end;
    
    procedure FindBanker();
    var
      x, y, i: integer;
    begin
      if not isLoggedIn() then
        exit;
    
      repeat
        mainscreen.findObject(x, y, 5279160, 8 , colorSetting(2, 0.32, 1.37), mainscreen.playerPoint, 10, 50, 20, ['ank', 'rnold', 'ydspor'], MOUSE_LEFT);
        wait(randomRange(1000, 2000));
    
        inc(i);
      until BankScreen.isOpen() or (i >= 15);
    end;
    
    procedure BankFish ();
    begin
      if bankScreen.isOpen(5000) then
          bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
          wait(randomRange(1000, 2000));
          bankScreen.close();
    
    
      exit;
    
    end;
    
    
    // main loop
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();
    
      sps.setup('MONKFISH_MAP', RUNESCAPE_OTHER);
    
      repeat
        if not isLoggedIn() then
        begin
          players[currentPlayer].login();
          exitTreasure();
          minimap.setAngle(MM_DIRECTION_NORTH);
          mainScreen.setAngle(MS_ANGLE_HIGH);
        end;
    
    
        begin
        //WalkToFishingSpot();               // I tried to use SPS tookbox to create an area to where I hoped the mouse would go to, but it doesn't seem to work
        //CatchingFish();                    // almost complete, however I'm attempting to make it only look for another fishing spot once my characters animation stops moving. I have looked in the SRL, but it's still a bit confusing to me lol
        //if tabBackpack.isFull() then       //~ Actually can't remmeber where I was going with this one, as I have not made a method for this xD
        // WalkToBank();                     //complete, this walks straight to tha bank icon as inteneded. If there is anything else that might improve it then do tell.
        // FindBanker();                    //complete, this finds the banker, but with very few colours. I'm trying to make this fulkly cvolour, Don't want to add any oglib (wanna practice the long route first)
        // BankFish();                      // Okay, so it banks the fish by the quick depoisit.. EASY..... BUT OMFG...... I can not for the life of me find out how to close the bank without manually creating a t-box for the 'x' button. I know there is an easy piece of code that will allow me to just press the ESC key, or close out of it. (again checked the SRL.. but still confusing.
        end;
        until(false);
        end.
    
        // LASTLY..... I am aware that there is no antiban, very few 'randomrange' waits etc..... I just wanna get the basics done first. All help is welcome, and EVEN better if anyone wants to private message me and give me some more pointers you would be awesome.

    P.S. I have tried to take,/change a lot of coding that is shown in the tutorials. (So all credit goes to the amazing tutiorials on this site <3 )

  3. #3
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    It doesn't walk to the fishing spot because you never told it to walk:

    Simba Code:
    procedure WalkToFishingSpot(); // All you do here is check if you are inside a polygon?
    var
      FishArea: TPoint; // TPoint? You have 4 points below, so this is a TPointArray
    begin
      FishArea := [[147, 11], [198, 9], [195, 41], [152, 41]];

      repeat
        writeLn('Found fishing spot: ', sps.isInPolygon(FishArea));
        wait(1000);
      until false;  // Stuck in this loop forever?

    end;

    Since your area has only 4 points, you could just turn it into a box, and walk to inside the box. Also, good to add a failsafe timer so you don't get stuck in the loop:

    Simba Code:
    procedure WalkToFishingSpot();
    var
      FishArea: TBox;
      T: TTimeMarker;
    begin
      FishArea := IntToBox(147, 11, 198, 41); // Turned this into a box
      T.start(); // Start timer

      repeat    // Repeat walking to box until we are inside box, or it's been 30sec
        sps.walkToBox(FishArea);
      until sps.isInBox(FishArea) or (T.getTime() > 30000);

    end;




    Next, in your CatchingFish() procedure, it all looks good apart from:

    Simba Code:
    tabBackpack.waitForShift(300000); // Wait 5 minutes to catch after clicking? What if you missclick the spot?

    I see you said you want to wait for your player to stop animating. You can do that, or an easier/reliable way is to just check when the inventory count hasn't changed in a while:

    Simba Code:
    procedure WaitForFish();
    var
      cnt: Integer;
      T: TTimeMarker;
    begin
      T.start();

      cnt := tabBackpack.count(); // Get the pack count

      repeat

        if (tabBackpack.count() <> cnt) then // If we have caught something, restart the timer & reset count
        begin
          T.start();
          cnt := tabBackpack.count();
        end;

      until (T.getTime > Random(15000, 30000)) or tabBackpack.isFull(); //stop if no catch in 15-30s or pack full
    end;

    So now you can replace tabBackpack.waitForShift() with WaitForFish().




    For WalkToBank(), you click the bank symbol and then wait until you stop moving. I would suggest doing something similar to walking to the fishing spot (creating an area and walking to it with sps) because it will be more reliable.




    Does your FindBanker() work fine with mainscreen.findObject? This method generally works 100% fine if you pick your colors correctly - did you pick heaps of colors from multiple worlds? You can always do more custom things yourself (similar to how you found the fishing spot), but findObject should work fine.




    You are missing a begin..end in the banking procedure:
    Simba Code:
    procedure BankFish ();
    begin
      if bankScreen.isOpen(5000) then
          bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);

          // these two will execute no matter what
          wait(randomRange(1000, 2000));
          bankScreen.close();


      exit;

    end;

    Should be:

    Simba Code:
    procedure BankFish();
    begin
      if bankScreen.isOpen(5000) then
      begin  // Alternatively, you use the preset buttons which also close the bank.
        bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
        bankScreen.close();
      end;
    end;




    Generally you mainloop is OK

    Simba Code:
    // main loop
    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      declarePlayers();

      sps.setup('MONKFISH_MAP', RUNESCAPE_OTHER);

      repeat
        if not isLoggedIn() then
        begin
          players[currentPlayer].login();
          exitTreasure();
          minimap.setAngle(MM_DIRECTION_NORTH);
          mainScreen.setAngle(MS_ANGLE_HIGH);
        end;

         // Obviously some issues here as there are no checks so see if these were successful.
        WalkToFishingSpot();
        CatchingFish();
        WalkToBank();
        FindBanker();
        BankFish();

      until(false);

    end.

  4. #4
    Join Date
    Oct 2012
    Posts
    1,258
    Mentioned
    40 Post(s)
    Quoted
    588 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    snip
    sexy post
    1 thing: this repeat loop looks like it'd be maxing out cpu usage via nonstop backpack counting. Adding a wait time [of less than 600 ms] after the 'ctn :=' line should help to reduce that a lot without affecting ingame functionality.

  5. #5
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by acow View Post
    sexy post
    1 thing: this repeat loop looks like it'd be maxing out cpu usage via nonstop backpack counting. Adding a wait time [of less than 600 ms] after the 'ctn :=' line should help to reduce that a lot without affecting ingame functionality.
    That is a common misconception. I doubt it would 'max out' CPU usage. The difference between a wait and no wait in that loop would probably be trivial (you are welcome to test).

  6. #6
    Join Date
    Oct 2012
    Posts
    1,258
    Mentioned
    40 Post(s)
    Quoted
    588 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    That is a common misconception. I doubt it would 'max out' CPU usage. The difference between a wait and no wait in that loop would probably be trivial (you are welcome to test).
    Can't test atm, what would stop that from occuring?

  7. #7
    Join Date
    Aug 2014
    Posts
    172
    Mentioned
    2 Post(s)
    Quoted
    77 Post(s)

    Default

    First of all, Thank you very much for looking through my small script.

    Yeah, i knew there were missing a few bits and bobs. Getting used to the resource library and I only have basic java knowledge.

    As soon as I wake up I'll try again to fix up a few things.

    For each step, I'll have to get a good way to walk to fishing spot properly.

    Catching fish works well, but I'll definitely have to look into finding a good way to know when to click on a new fishing spot.

    Walking to the bank works perfectly so far.

    Finding the banker is only working through a bunch of different colours, but not too many different ones, as the boxes and netting around use the same colours which make it quite hard to find the best colours.

    Banking the fish is simple, but closing the bank should work if I create a new begin/end like you say, as I don't want to do it through a preset.

    I'll post up an updated version when I have time. I also hope that me creating a script pushes some more people to attempt their own scripts. Even if you create something small like I have, as you can see there are people willing to help.

  8. #8
    Join Date
    Oct 2012
    Posts
    1,258
    Mentioned
    40 Post(s)
    Quoted
    588 Post(s)

    Default

    @Laquisha; It maxed out the cpu resources available to simba and was asking for more http://i.imgur.com/tfB3Fkl.png

    Why did you consider that a common misconception btw? I'd say the opposite is true @Harrier; //jokes, plz don't send me death threats on irc ty

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
  •