Results 1 to 11 of 11

Thread: Banking

  1. #1
    Join Date
    Apr 2016
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default Banking

    I'm fairly new to scripting, and tend to have trouble learning a lot(a bit out of my control) - anyways. I'm in need of help trying to get my script to bank, I don't know really how to do it, I've looked for tutorials, they seem to cease to exist?? apart from the little mention of it in the beginners guide, but that doesn't teach me how to apply it, so it doesn't help me really.

    here's the code that I have so far, on what I think a bank process(sort of) would start to look like:
    if it helps anyone in knowing, it banks at Edgeville, so the colour is for edgeville bank NPCs

    Enjoy my most likely horrible standards.
    Simba Code:
    procedure Bank();
      begin
        repeat
          if not isLoggedin() then
            break;
          mainscreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT);
          wait(randomRange(1321, 2534 ));  
        until bankscreen.isOpen();
      if bankscreen.isOpen();
        then   bankScreen.clickButton(BANK_BUTTON_PRESET_1);// will this actually work?
      end;

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

    Default

    Quote Originally Posted by hyperoux View Post
    I'm fairly new to scripting, and tend to have trouble learning a lot(a bit out of my control) - anyways. I'm in need of help trying to get my script to bank, I don't know really how to do it, I've looked for tutorials, they seem to cease to exist?? apart from the little mention of it in the beginners guide, but that doesn't teach me how to apply it, so it doesn't help me really.

    here's the code that I have so far, on what I think a bank process(sort of) would start to look like:
    if it helps anyone in knowing, it banks at Edgeville, so the colour is for edgeville bank NPCs

    Enjoy my most likely horrible standards.
    Simba Code:
    procedure Bank();
      begin
        repeat
          if not isLoggedin() then
            break;
          mainscreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT);
          wait(randomRange(1321, 2534 ));  
        until bankscreen.isOpen();
      if bankscreen.isOpen();
        then   bankScreen.clickButton(BANK_BUTTON_PRESET_1);// will this actually work?
      end;
    Your code is basically correct, except the biggest flaw is if the bank isn't actually on screen: it will be stuck in that loop forever (infinite loop).

    Here is essentially the same thing with a 30 second timer:

    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;

          if mainScreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT) then
            if bankScreen.isOpen(random(3000, 5000)) then // Wait for 3-5 sec for bank to open
            begin
              writeLn('Yay, bank is open, let''s deposit stuff');

              if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
                break; // Break out if clickButton returns true (it returns true if bank is closed)

            end;
      until (timer.getTime() > 30000); // Stop trying after 30 seconds

      writeLn('Failed to bank within 30 seconds');
    end;

    You could also replace the mainScreen.findObject(..) and bankScreen.isOpen(..) lines with the inbuilt bankScreen.open(BANK_NPC_BLUE)

  3. #3
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Quote Originally Posted by TSN View Post
    ...
    Otherwise good but the findObject will fail if the bank is already open. E.g. It clicks once but lags a delay, or the procedure is called while the bank is already open.

    tl;dr check if the bank is open before findObject or make an or condition.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  4. #4
    Join Date
    Apr 2016
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by TSN View Post
    Your code is basically correct, except the biggest flaw is if the bank isn't actually on screen: it will be stuck in that loop forever (infinite loop).

    Here is essentially the same thing with a 30 second timer:

    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;

          if mainScreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT) then
            if bankScreen.isOpen(random(3000, 5000)) then // Wait for 3-5 sec for bank to open
            begin
              writeLn('Yay, bank is open, let''s deposit stuff');

              if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
                break; // Break out if clickButton returns true (it returns true if bank is closed)

            end;
      until (timer.getTime() > 30000); // Stop trying after 30 seconds

      writeLn('Failed to bank within 30 seconds');
    end;

    You could also replace the mainScreen.findObject(..) and bankScreen.isOpen(..) lines with the inbuilt bankScreen.open(BANK_NPC_BLUE)
    How could I go about doing that? I don't really know anything about those, or how to implement those types of things into my scripts.

    Quote Originally Posted by Joopi View Post
    Otherwise good but the findObject will fail if the bank is already open. E.g. It clicks once but lags a delay, or the procedure is called while the bank is already open.

    tl;dr check if the bank is open before findObject or make an or condition.
    Is there a tutorial I could read to find out how to make a check for this case? I looked over the beginners tutorial, and didn't see a whole lot on checks, I believe I have a vague idea on what you mean.
    Simba Code:
    if bankScreen.isOpen then
      //do something, like follow through
      // with banking and not doing the findObject?
    Last edited by hyperoux; 05-03-2016 at 10:17 AM.

  5. #5
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;

          if mainScreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT) or bankScreen.isOpen() then
            if bankScreen.isOpen(random(3000, 5000)) then // Wait for 3-5 sec for bank to open
            begin
              writeLn('Yay, bank is open, let''s deposit stuff');
              Wait(500 + random(400)); // recommended to wait a bit before pressing the button, otherwise it might mess up and or get banned.
             
              //I always put this in a loop with many failsafes just to make sure it does manage to press the preset, e.g. lag won't mess it up.
              if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
                break; // Break out if clickButton returns true (it returns true if bank is closed)

            end;
      until (timer.getTime() > 30000); // Stop trying after 30 seconds

      writeLn('Failed to bank within 30 seconds');
    end;

    This should work (notice the or condition to the right) given that the colors are right. It's a bit unnecessary to check if bank's open twice but it shouldn't matter though. I mean you could use a goto but thats just going to be confusing for you.
    Last edited by Joopi; 05-03-2016 at 10:46 AM.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  6. #6
    Join Date
    Apr 2016
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;

          if mainScreen.findObject(x, y, 8143188, 14, colorSetting(2, 0.38, 0.69), mainscreen.getCenterPoint(), 10, 50, 1, ['ank'], MOUSE_LEFT) or bankScreen.isOpen() then
            if bankScreen.isOpen(random(3000, 5000)) then // Wait for 3-5 sec for bank to open
            begin
              writeLn('Yay, bank is open, let''s deposit stuff');
              Wait(500 + random(400)); // recommended to wait a bit before pressing the button, otherwise it might mess up and or get banned.
             
              //I always put this in a loop with many failsafes just to make sure it does manage to press the preset, e.g. lag won't mess it up.
              if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
                break; // Break out if clickButton returns true (it returns true if bank is closed)

            end;
      until (timer.getTime() > 30000); // Stop trying after 30 seconds

      writeLn('Failed to bank within 30 seconds');
    end;

    This should work (notice the or condition to the right) given that the colors are right. It's a bit unnecessary to check if bank's open twice but it shouldn't matter though. I mean you could use a goto but thats just going to be confusing for you.
    Yeah fair enough, I'll get around to learning things like those later on, when I'm more confident with the basic things. Thanks for all of the help, appreciate it.

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

    Default

    Quote Originally Posted by hyperoux View Post

    Quote Originally Posted by TSN
    You could also replace the mainScreen.findObject(..) and bankScreen.isOpen(..) lines with the inbuilt bankScreen.open(BANK_NPC_BLUE)
    How could I go about doing that? I don't really know anything about those, or how to implement those types of things into my scripts.
    Just do what I said, and replace those two lines. It will solve all your problems:

    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;
         
          if bankScreen.open(BANK_NPC_BLUE) then // i.e., put this instead
          begin
            writeLn('Yay, bank is open, let''s deposit stuff');

            if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
              break;
          end;
      until (timer.getTime() > 30000);

      writeLn('Failed to bank within 30 seconds');
    end;

  8. #8
    Join Date
    Apr 2016
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by TSN View Post
    Just do what I said, and replace those two lines. It will solve all your problems:

    Simba Code:
    procedure Bank();
    var
      x, y: Integer;
      timer: TTimeMarker;
    begin
      timer.start();

      repeat
        if (not isLoggedin()) then
          break;
         
          if bankScreen.open(BANK_NPC_BLUE) then // i.e., put this instead
          begin
            writeLn('Yay, bank is open, let''s deposit stuff');

            if bankScreen.clickButton(BANK_BUTTON_PRESET_1) then
              break;
          end;
      until (timer.getTime() > 30000);

      writeLn('Failed to bank within 30 seconds');
    end;
    Ah I see, that's pretty neat, thanks heaps for showing that, and helping me with banking.
    One last question though; Every time it goes to bank, it ends up clicking the search button in the bank, how can I rectify this?

  9. #9
    Join Date
    Aug 2014
    Location
    Australia
    Posts
    932
    Mentioned
    53 Post(s)
    Quoted
    495 Post(s)

    Default

    Quote Originally Posted by hyperoux View Post
    Ah I see, that's pretty neat, thanks heaps for showing that, and helping me with banking.
    One last question though; Every time it goes to bank, it ends up clicking the search button in the bank, how can I rectify this?
    Unless the BANK_BUTTON_PRESET_1 constant is broken, there's nothing in that procedure that should click on the search button.



    New to scripting? Procedures & Functions for Beginners
    Do you use your computer at night? Just get f.lux

  10. #10
    Join Date
    Apr 2016
    Posts
    20
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Incurable View Post
    Unless the BANK_BUTTON_PRESET_1 constant is broken, there's nothing in that procedure that should click on the search button.
    would any settings perhaps make that possible? like interface position, directX over OpenGl, that sort of thing.

  11. #11
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by hyperoux View Post
    would any settings perhaps make that possible? like interface position, directX over OpenGl, that sort of thing.
    i believe there is also a button what you can press that activates the preset, try that.

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
  •