Results 1 to 9 of 9

Thread: General Patrick's Draynor Fisher

  1. #1
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Talking [SRL6]General Patrick's Draynor Fisher

    [SRL6]General Patrick's Draynor Fisher
    ____________________________

    This script was last updated on January 28th, 2016.

    Current Version: 1.1



    Introduction



    Here is the first script I have ever made that actually works! There still some things that i want to do such as bugfixing the
    progress report procedure and adding a fail-safe, but other than that it works well.

    Goal



    The main goal is to get some advice on how to improve this script. It is my first published script, so any advice is welcome.

    Features


    • SRL Player Form
    • antiban
    • Progress Reports
    • Breaks
    • Banking
    • Updater
    • Price Grabbing
    • Map Grabbing
    • walking Failsafes


    Future Plans


    • Add Grats Stats
    • Put the script into the public RS3 scripts section.


    Setup Instructions


    • Have your character located at the Draynor Bank or the fishing spot below with an empty inventory.
    • Have your xp tracker here :
    • Follow the SRL setup here : https://villavu.com/forum/showthread.php?t=47714
    • Put your character information into the Rafiki Player Manager.
    • Start the Script (F9)!


    Changelog


    • 1.0:
      Initial Release.
    • 1.1:
      Added Failsafe, improved progress report and compressed code. Currently working on an on-screen Progress Report, failsafe frequency, and any possible bugs.


    Known Bugs


    • Progress Report: Bug where the amount of counted fish is doing it too many times than necessary.


    Conclusion


    If you guys can post your progress reports and give some advice on how to improve the script, I would really appreciate it.

    Credits


    If you guys can post your progress reports and give some advice on how to improve the script, I would really appreciate it.
    • Thank you The Mayor for your scripting guides.
    • Thank you Taric, Ashman88, & Keepbotting for your previous scripts that i took inspiration from.
    • Thank you TSN for your advice on how to improve the script.
    Attached Files Attached Files
    Last edited by General_Patrick; 01-19-2016 at 03:38 PM. Reason: Formatting

  2. #2
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    If possible, could a moderator please move this to the Public RS3 Fishing Script Section?

  3. #3
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    I updated the script to 1.1! Read the changelog for more information.

  4. #4
    Join Date
    Jan 2012
    Location
    East Coast
    Posts
    733
    Mentioned
    81 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by General_Patrick View Post
    If possible, could a moderator please move this to the Public RS3 Fishing Script Section?
    Report the original post and request that it be moved to that section, that way an Admin or a Moderator will see it and can move it

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

    Default

    People don't give feedback on scripts anymore, but since it's my lunch break, here is some:

    Why the TRSChatBox.getXP(), could you not use: http://docs.villavu.com/srl-6/chatbox.html#getxpbar

    I think this loop is a little unnecessary. If the fishing spot disappears, it can potentially wait for 16 seconds doing absolutely nothing:

    Simba Code:
    for i := 0 to (randomRange(8, 16)) do
      begin
        if tabBackpack.isFull() then
        exit(false);
        wait(randomRange(800, 1200));
      end;

    You need to think about your variable scope. There are some instances where your global variables can be declared locally. You can also probably combine your progress report stuff to avoid having all of those variables in memory.

    This loop:

    Simba Code:
    for i := 0 to high(players) do
        with players[i] do
        begin

          botLength := strToInt(playerForm.players[i].settings[0]) * 60000; //bot length before breaking
          breakLength := strToInt(playerForm.players[i].settings[1]) * 60000; //break duration
          world := strToInt(playerForm.players[i].settings[2]); //preferred world
          bankNum := strToInt(playerForm.players[i].settings[3]); //your bank pin

          debugLog := strToBool(playerForm.players[i].settings[4]); //debug Log
          findMod := strToBool(playerForm.players[i].settings[5]); //find mods
      end;

    The variables botLength, breakLength etc. are integers. If you have more than one player, the value of those variables will get overwritten each time it initializes a new player. You should either change them to arrays, or use the player arrays built into the include (players[i].integers[0] := ... )

    Instead of doing

    Point(150 + randomRange(-5, 5), 178 + randomRange(-5, 5))

    you can do

    Point(148, 176).rand(5)

    Also, these few methods:

    Simba Code:
    walkToPlace(2);
    wait(randomRange(600,800));
    bankScreen.open(BANK_NPC_DRAYNOR);
    wait(randomRange(600,800));
    if pinScreen.isOpen() then pinScreen.enter(intToStr(bankNum));
    bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
    bankScreen.close();

    What if it cannot find the bank? It will still check if the pin screen is open. It will still try and deposit fish, and it will still try and close the bank screen (all which will fail). You should put those in a new block so it doesn't run those methods when there is no point running them:

    Simba Code:
    if bankScreen.open(BANK_NPC_DRAYNOR) then
    begin
      if pinScreen.isOpen()
        then pinScreen.enter(intToStr(bankNum));

      if bankScreen.getPackCount() > 0 then
        bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);

      bankScreen.close();
    end;

    Last bit:

    Simba Code:
    repeat
      mainLoop();
    until (players.getActive() < 1);
    terminateScript();
    freeDTM(dtmArr[0]);
    freeDTM(dtmArr[1]);

    So when do you free your DTMs?

  6. #6
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Quote Originally Posted by TSN View Post
    Why the TRSChatBox.getXP(), could you not use: http://docs.villavu.com/srl-6/chatbox.html#getxpbar
    In Version 1.1, I actually fixed this before you posted it XD.


    Quote Originally Posted by TSN View Post
    I think this loop is a little unnecessary. If the fishing spot disappears, it can potentially wait for 16 seconds doing absolutely nothing:

    Simba Code:
    for i := 0 to (randomRange(8, 16)) do
      begin
        if tabBackpack.isFull() then
        exit(false);
        wait(randomRange(800, 1200));
      end;
    I actually didn't think about that. The newest version has an an improved isstillfishing function with your suggestion.
    Obviously, I gave credit to you

    Quote Originally Posted by TSN View Post
    You need to think about your variable scope. There are some instances where your global variables can be declared locally. You can also probably combine your progress report stuff to avoid having all of those variables in memory.

    This loop:

    Simba Code:
    for i := 0 to high(players) do
        with players[i] do
        begin

          botLength := strToInt(playerForm.players[i].settings[0]) * 60000; //bot length before breaking
          breakLength := strToInt(playerForm.players[i].settings[1]) * 60000; //break duration
          world := strToInt(playerForm.players[i].settings[2]); //preferred world
          bankNum := strToInt(playerForm.players[i].settings[3]); //your bank pin

          debugLog := strToBool(playerForm.players[i].settings[4]); //debug Log
          findMod := strToBool(playerForm.players[i].settings[5]); //find mods
      end;

    The variables botLength, breakLength etc. are integers. If you have more than one player, the value of those variables will get overwritten each time it initializes a new player. You should either change them to arrays, or use the player arrays built into the include (players[i].integers[0] := ... )
    Right now this is an issue, but at the moment it's not a make-or-break issue for me. I'll eventually get to it, but there's other things
    I want to focus on before on (i.e bugfixing the failsafe procedure, improved clicking on the fishing spot, and adding a SMART progress report).
    That, or i just don't know how to do it yet :P

    Quote Originally Posted by TSN View Post
    Instead of doing

    Point(150 + randomRange(-5, 5), 178 + randomRange(-5, 5))

    you can do

    Point(148, 176).rand(5)
    Oooo. I actually didn't know about that. Thanks for sharing!

    Quote Originally Posted by TSN View Post
    Also, these few methods:

    Simba Code:
    walkToPlace(2);
    wait(randomRange(600,800));
    bankScreen.open(BANK_NPC_DRAYNOR);
    wait(randomRange(600,800));
    if pinScreen.isOpen() then pinScreen.enter(intToStr(bankNum));
    bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
    bankScreen.close();

    What if it cannot find the bank? It will still check if the pin screen is open. It will still try and deposit fish, and it will still try and close the bank screen (all which will fail). You should put those in a new block so it doesn't run those methods when there is no point running them:

    Simba Code:
    if bankScreen.open(BANK_NPC_DRAYNOR) then
    begin
      if pinScreen.isOpen()
        then pinScreen.enter(intToStr(bankNum));

      if bankScreen.getPackCount() > 0 then
        bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);

      bankScreen.close();
    end;
    Hmm..I actually didn't think about adding a failsafe for banking. Thanks for your input.

    Quote Originally Posted by TSN View Post
    Last bit:

    Simba Code:
    repeat
      mainLoop();
    until (players.getActive() < 1);
    terminateScript();
    freeDTM(dtmArr[0]);
    freeDTM(dtmArr[1]);

    So when do you free your DTMs?
    At the end of my initscript procedure i had this little line of code:
    Simba Code:
    addonTerminate('clearDtms');

  7. #7
    Join Date
    Feb 2015
    Posts
    422
    Mentioned
    41 Post(s)
    Quoted
    226 Post(s)

    Default

    Quote Originally Posted by General_Patrick View Post
    In Version 1.1, I actually fixed this before you posted it XD.



    I actually didn't think about that. The newest version has an an improved isstillfishing function with your suggestion.
    Obviously, I gave credit to you


    Right now this is an issue, but at the moment it's not a make-or-break issue for me. I'll eventually get to it, but there's other things
    I want to focus on before on (i.e bugfixing the failsafe procedure, improved clicking on the fishing spot, and adding a SMART progress report).
    That, or i just don't know how to do it yet :P


    Oooo. I actually didn't know about that. Thanks for sharing!


    Hmm..I actually didn't think about adding a failsafe for banking. Thanks for your input.


    At the end of my initscript procedure i had this little line of code:
    Simba Code:
    addonTerminate('clearDtms');
    actually the randomization you had and .rand will do different things

    you had

    Point(x+ randomRange(-3, 3), y + randomRange(-3, 3))

    which will randomize point x and y and give you these possible results [x+ -3, x+ -2, x+ -1, x, x+1,x+2] and the same thing with y to a total of 36 possible points to click on.

    Point(x, y).rand(3) however will only give you these possible results [x, x+1, x+2] and the same thing with Y, to a total of 9 possible points to click on.

    now that isn't even the major difference, the difference is that with .rand you only get randomization in one direction, either positive,positive or negative,negative. However, with the method you had, randomization is applied in all directions.

  8. #8
    Join Date
    Aug 2013
    Posts
    63
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Quote Originally Posted by fady View Post
    actually the randomization you had and .rand will do different things

    you had

    Point(x+ randomRange(-3, 3), y + randomRange(-3, 3))

    which will randomize point x and y and give you these possible results [x+ -3, x+ -2, x+ -1, x, x+1,x+2] and the same thing with y to a total of 36 possible points to click on.

    Point(x, y).rand(3) however will only give you these possible results [x, x+1, x+2] and the same thing with Y, to a total of 9 possible points to click on.

    now that isn't even the major difference, the difference is that with .rand you only get randomization in one direction, either positive,positive or negative,negative. However, with the method you had, randomization is applied in all directions.
    Oh ok. I guess I should change it back to how it used to be. Thanks for the info!

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

    Default

    Quote Originally Posted by fady View Post

    now that isn't even the major difference, the difference is that with .rand you only get randomization in one direction, either positive,positive or negative,negative. However, with the method you had, randomization is applied in all directions.
    Quote Originally Posted by General_Patrick View Post
    Oh ok. I guess I should change it back to how it used to be. Thanks for the info!
    This is true, although I should have mentioned what I did with the example. You will notice I didn't use the exact same coordinates as the original point, but user smaller x and y values. You can achieve the same thing with easier-to-read code. E.g:

    Point(150 + randomRange(-5, 5), 180 + randomRange(-7, 7))

    =

    Point(145, 173).rand(10, 14);

    EDIT: Although, if you wanted something even nicer, you could just pass in a randomised path to walkPath:

    Simba Code:
    program new;

    function TPointArray.rand(Amount: Integer): TPointArray;
    var
      i: Integer;
    begin
      SetLength(Result, Length(Self));

      for i := 0 to High(Self) do
      begin
        Result[i].X := Self[i].X + Random(-Amount, Amount);
        Result[i].Y := Self[i].Y + Random(-Amount, Amount);
      end;
    end;

    var
      TPA: TPointArray;
    begin
      TPA := [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]];
      WriteLn(TPA.rand(5));

      sps.walkPath(myPath.rand(5)); //e.g
    end.

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
  •