Results 1 to 11 of 11

Thread: Universal Banker Include - Bank anywhere with one line of code

  1. #1
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default Universal Banker - Walk-To and Bank with one Line of Code!

    Universal Banker Include
    At the moment, this include only includes F2P Banks.

    What does this include do?
    • Will attempt to walk to any F2P bank location
    • Opens the bank once it has made it there
    • Climb ladders/staircases to get on the correct bank floor level
    • Uses the Al-Kharid toll gate to get to the alkharid bank
    • If the player is in the wilderness, it will get to the ditch, and jump over.



    Instructions
    1. Downlaod the Banker.simba file below, and place it in your "Includes" folder
    2. Below "{$i Reflection/Reflection.Simba} " add "{$i Banker.Simba} in your script"
    3. In your initial script setup (or anywhere before using a banking function) Add "LoadBanks();'


    Congratulations! You can now bank with one line of code.

    FORMAT FOR BANKING FUNCTIONS
    BankNameHere.openbank();.

    Example: alkharid.openbank(); will go to the alkharid bank, and open it

    List of current bank location names:
    Edgeville, Draynor, V_East, V_West, AlKharid, F_East, F_West, Lumbridge, Piscarilius
    Attached Files Attached Files
    Last edited by Aspect; 09-01-2016 at 02:26 AM.

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

    Default

    Nice idea. I think you can make this project much simpler if you create a new bank data type (record) that will store the name/tile/UpText information. This was you can (1) have one function that will open ALL banks, (2) avoid copying and pasting the same code (with 1 or 2 changes) to open different banks, (3) add new banks with 1 line of code, (4) be much simpler/cleaner/easier to maintain.

    If you haven't used records before, then it may take a while to get your head around them. Here is a nice tutorial: https://villavu.com/forum/showthread.php?t=113227

    Basically you can do this:

    Simba Code:
    {The bank include}

    // Create a record to store bank information
    type TBank = record
      Name: String;
      Tile: TTile;  
      UpText: TStringArray;
    end;

    // Create some variables of this new TBank data type
    var
      Edgeville, Draynor: TBank;

    // A method to assign information to a bank variable/instance
    procedure TBank.Create(_Name: String; _Tile: TTile; _UpText: TStringArray);
    begin
      Self.Name := _Name;
      Self.Tile := _Tile;
      Self.UpText := _UpText;
    end;

    // A method to assign bank information (name/tile/text) to bank variables (Edgeville/Draynor) using the above method
    procedure LoadBanks();
    begin
      Edgeville.Create('Edgeville', [1234, 1234], 'ank Booth');
      Draynor.Create('Draynor Box', [4321, 4321], 'eposit Box');
      // etc.
    end;

    // A type method to open whatever bank is passed to it
    function TBank.Open(): Boolean;
    var
      Bank: TReflectObject;
    begin
      WriteLn('Walking to ', Self.Name)
     
      Player.BlindWalkMM(Self.Tile, 2);
       
      if  Bank.Find(objGame, Self.UpText, 5) then
      begin
        //etc
      end;

      Result := Reflect.Bank.IsOpen();
    end;


    {Inside the users script}

    procedure DoBanking();
    begin
      if Edgeville.Open() then
        WriteLn('Opened Edgeville bank');

      if Draynor.Open() then
        WriteLn('Opened Edgeville bank');

      //etc..
    end;

  3. #3
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    I really like that idea. I've been trying to learn to use records and this may be a good time to pick it up. Would the user need to use the loadBanks () procedure to create the banks that they use later on?

  4. #4
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Updated the include to use records. I'm going to add plane detection next, so that the bot will climb up/down stairs or ladders to attempt to make it to the bank.

  5. #5
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Nice release mate.

    Does this blindwalk to the bank from the player's position, or does it rely on the player to get themselves to the bank before utilising the include?

  6. #6
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Quote Originally Posted by Dan the man View Post
    Nice release mate.

    Does this blindwalk to the bank from the player's position, or does it rely on the player to get themselves to the bank before utilising the include?
    It will attempt to blind walk to the banking location, then open the bank. I'm working on making this more versatile at the moment as well.

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

    Default

    Quote Originally Posted by Aspect View Post
    I really like that idea. I've been trying to learn to use records and this may be a good time to pick it up. Would the user need to use the loadBanks () procedure to create the banks that they use later on?
    The easiest way would be to call the loadBanks() inside the include file when the script starts, giving the user access to all the banks. Obviously all the banks would be loaded in memory, but there isn't really that many of them.

    Quote Originally Posted by Aspect View Post
    It will attempt to blind walk to the banking location, then open the bank. I'm working on making this more versatile at the moment as well.
    Blind walking isn’t really reliable unless you are reasonably close to the bank and there are no obstructions (like walking through a closed building).

    As this is written in reflection it would be possible to create a walking system that is able to navigate to any location, from any other location (using a series of nodes and an algorithm like Dijkstra to solve the shortest path problem - http://puu.sh/qTdGQ/55686e5bcb.png). To add complexity (and accuracy), each edge (line) or node (point) can have a barrier attribute, which the shortest path algorithm will take into account when solving the path (e.g. an node will be avoided if you don’t meet the agility shortcut requirements).

    I don’t think anything like that has been done here at villavu as the focus has always been on color, but some reflection/injecting bots created ‘web-walking’ systems that use these ideas. Quite a big project though.

  8. #8
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    The easiest way would be to call the loadBanks() inside the include file when the script starts, giving the user access to all the banks. Obviously all the banks would be loaded in memory, but there isn't really that many of them.



    Blind walking isn’t really reliable unless you are reasonably close to the bank and there are no obstructions (like walking through a closed building).

    As this is written in reflection it would be possible to create a walking system that is able to navigate to any location, from any other location (using a series of nodes and an algorithm like Dijkstra to solve the shortest path problem - http://puu.sh/qTdGQ/55686e5bcb.png). To add complexity (and accuracy), each edge (line) or node (point) can have a barrier attribute, which the shortest path algorithm will take into account when solving the path (e.g. an node will be avoided if you don’t meet the agility shortcut requirements).

    I don’t think anything like that has been done here at villavu as the focus has always been on color, but some reflection/injecting bots created ‘web-walking’ systems that use these ideas. Quite a big project though.
    This would be a great feature. As of now I'm focusing on adding all of the banks on both F2P and memebrs worlds, as well as any type of banking chest and deposit box, as well as the ability to move between different planes to achieve the banking plane. I could see how blind walking may cause an issue when the bank is not currently within the players bounds or proximity. This system would be a great thing to implement in the future once all of the basics of the include are finished.

  9. #9
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Did a massive update to finish the F2P Version. If anyone encounters any major barriers, let me know and I'll patch them up.

  10. #10
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    First of, nice job I did a quick scan through your code, apart from some edge-cases it's looking pretty good!

    Here is some things you could improve on:
    There's some potentially infinite loops whenever you're assuming the repeat-until condition will occur. Add in a timed failsafe so that it will exit the loop after an appropriate time period (specifically these kind of conditions: until Reflect.Tiles.DistanceFromTile(blah) <= X;, it's not given that blindwalkmm will succeed).

    I also spotted a bug in MoveDown and MoveUp: The bug is it will still search for (and climb) a staircase even though it might have climbed a ladder already.
    I'm not sure if you'll encounter this bug in practice, but IIRC lumbridge has a bank with both a staircase and a ladder so you might encounter it there.

  11. #11
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    First of, nice job I did a quick scan through your code, apart from some edge-cases it's looking pretty good!

    Here is some things you could improve on:
    There's some potentially infinite loops whenever you're assuming the repeat-until condition will occur. Add in a timed failsafe so that it will exit the loop after an appropriate time period (specifically these kind of conditions: until Reflect.Tiles.DistanceFromTile(blah) <= X;, it's not given that blindwalkmm will succeed).

    I also spotted a bug in MoveDown and MoveUp: The bug is it will still search for (and climb) a staircase even though it might have climbed a ladder already.
    I'm not sure if you'll encounter this bug in practice, but IIRC lumbridge has a bank with both a staircase and a ladder so you might encounter it there.
    I could see why this would cause issues. In the next update I'll add member overworld banks, and insure it checks if it's on the correct level after climbing a ladder, before using the stairs. I can add timers as well. ( and maybe some fail-safes to prevent that from happening in the first place)

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
  •