Results 1 to 12 of 12

Thread: BankNearestBankerVWB

  1. #1
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default BankNearestBankerVWB

    Something I've been playing around with. Only works with varrock west bank.

    Finds the banker npcs on the minimap, figures out which one is the closest, translates that to onscreen and banks at that bankbooth.

    Works pretty well for me, but curious to see if it falls down when "released to the wild".

    Code:
    {*******************************************************************************
    function C_BankNearestBankerVWB(): Boolean;
    By: Bixby Sayz
    Description: Attempts to bank at the nearest bank booth in varrock west bank.
      Returns true on success.
    Note: There is enough uncertainty/randomness in the conversions that randomness
      in the mouse clicking isn't really required.
    *******************************************************************************}
    function C_BankNearestBankerVWB(): Boolean;
    var
      Npc     : TPointArray;  // Location of npcs on minimap.
      ScreenPt: TPoint;       // Screen point.
      Sx, Sy  : Integer;      // Screen (x,y) coords.
    begin
      Result := False;
      if not LoggedIn then
        Exit;
    
      // We need proper rotation/camera angle for this to work.
      SetAngle(True);
      MakeCompass('n');
      
      // Figure out nearest npc on minimap.
      Npc := GetMiniMapDots('npc');
      if (High(Npc) = 0) then
        Exit;
      SortTPAFrom(Npc, Point(MMCX, MMCY));
      if (Npc[0].x = 0) then
        Exit;
        
      // Convert minimap point to main screen point. Conversion isn't 100% accurate
      //   so some tweaking is needed, plus we want the bank booth not the banker
      //   itself.
      ScreenPt := MMToMS(Npc[0]);
      Sx := ScreenPt.x;
      Sy := ScreenPt.y;
      
      IncEx(Sx, (MMCX - Npc[0].x));
      if (Npc[0].x > MMCX) then
        DecEx(Sx, 25)
      else
        IncEx(Sx, 70);
      DecEx(Sy, 15);
    
      // Move mouse over to where we think bank booth is and look for bank booth
      //   color in a box centered on that point.
      MMouse(Sx, Sy, 0, 0);
      if not WaitFindColor(Sx, Sy, BankBoothColor, (Sx - 20), (Sy - 20), (Sy + 20), (Sy + 20), 5, 500) then
        Exit;
    
      // Move mouse to where we now know the bank booth is and double check the
      //   the uptext to be sure. If we have a match, right-click and select
      //   "Use-quickly bank booth".
      MMouse(Sx, Sy, 0, 0);
      if not WaitUpText('booth', 500) then
        Exit;
      Mouse(Sx, Sy, 0, 0, False);
      Wait(RandomRange(100, 250));
      if not WaitOption('quickly', 500) then
        Exit;
    
      // We should have an open bankscreen at this point.
      Result := BankScreen;
    end;
    Also attached a script that tests it. Requires latest srl dev and smart 4.5. Place yourself anywhere in varrock west bank and run.

    Edit: Broken since the Sep 17 update. Only works accurately if standing in middle of bank now. Won't have time to fix it for a while.
    Last edited by Bixby Sayz; 09-20-2009 at 08:21 AM.

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Lol, all that commenting on your code. I have to do that in my Java class
    Nevertheless, nice job
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    Lol, all that commenting on your code. I have to do that in my Java class
    Nevertheless, nice job
    I used to work for someone who had trouble understanding any code unless you basically commented every single line and put a summary of each logic block above in comments and a summary of the rountine in comments at the top.

    After while I got in the habit of just writing comments first then filling in a lot of the time. Plus it is handy when things go wrong and you go back 1 yr later and try to figure out what the hell you where thinking when you wrote it.

  4. #4
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    hah. I did such function as well =). Only that i'm scanning the mainscreen for the closest bank booth.

    Good Job on yours. I just wonder how accurate it is, since it seems to convert the minimap to the mainscreen, does that work well ?.

    ~caused

  5. #5
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by caused View Post
    I just wonder how accurate it is, since it seems to convert the minimap to the mainscreen, does that work well ?.
    Found the conversion function when browsing through the srl includes, which got me to wondering the exact same thing. Soo I came up with these.

    It gets you sort of close. I had to tweak the results, and how much to tweak differs according to whether you closest to the east or west row of bankers. Enough that I just couldn't get consistent results aiming for the bankers themselves.

    But looking for the bank booth has enough leeway that it works. Have not tried it since the latest update, so god knows if it still works. Won't be able to script/test for a few days.

  6. #6
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Mind if i use? Im scripting a VWB FireMaker right now
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  7. #7
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    You are welcome to use it, but may want to wait until I fix it. The new round of updates seems to have broken it.

    Now seems to work fine if standing in the middle of the bank, but way off if standing close to a banker.

  8. #8
    Join Date
    Sep 2009
    Location
    Zion
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do you rekon you could add a vial filler loop onto this script please

  9. #9
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bixby Sayz View Post
    You are welcome to use it, but may want to wait until I fix it. The new round of updates seems to have broken it.

    Now seems to work fine if standing in the middle of the bank, but way off if standing close to a banker.
    I will fix myself thanks
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  10. #10
    Join Date
    Jul 2009
    Posts
    421
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by danishkahn View Post
    Do you rekon you could add a vial filler loop onto this script please
    I could make a vial filler i guess it takes like 5 mins or you could learn to script and make it yourself
    Quote Originally Posted by Cstrike View Post
    Why do I even try these things? I just shit my pants over this god damn tutorial. Fuck, that's uncleanable. I can't even wash that out because there's so much of my shit it will just stain everything else. If I put it in the washing machine, I'm sure to stain the sides.

  11. #11
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Wow dude, it's incredibly accurate!
    Mind if I use this?

    E: I took this
    SCAR Code:
    {MMouse(Sx, Sy, 0, 0);
      if not WaitFindColor(Sx, Sy, BankBoothColor, (Sx - 20), (Sy - 20), (Sy + 20), (Sy + 20), 5, 500) then
        Exit;}
    Away because it caused weird problems, now it works
    Last edited by marpis; 09-24-2009 at 04:33 PM.

  12. #12
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    Wow dude, it's incredibly accurate!
    Mind if I use this?
    You are welcome to use this if it is useful. It works for you ???

    I've had no luck with it since the last update, so have completely rewritten it.

    Haven't released that version since it includes a rewrite of MMToMS in Banking.scar that is only about 90% complete. (The x coords are bang on, but have to collect some more sample data and correct the y calculations) Just have not have had time lately, hoping this weekend.

    Anyway if it works for you, go for it, just give credit.

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
  •