Results 1 to 6 of 6

Thread: Help me discover the mystery of the messed up withdrawing from bank

  1. #1
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default Help me discover the mystery of the messed up withdrawing from bank

    I have had an issue with a procedure for a few days now. The more I think about it and the less I understand what goes wrong. Maybe one of you can help me see more clearly. The issue is that my banking procedure has a tendency to withdraw and then deposit all before withdrawing once more, at random. It proceeds to the next functions and procedures of the script after that usually. Sometimes, it gets into an endless loop of withdraws and deposit all. Other time, it just happens once in 10 minutes with everything else working fine. Either way, I'm clueless about what might cause it. I added a "CloseBank" at the beginning of the procedure to find out if it's caused by the procedure being called twice and I found out that it isn't so I know it's a problem within the procedure, but I just can't see what could cause it.

    Here is the procedure:

    Simba Code:
    procedure BankEr;
    var
      x, y : Integer;
      s : String;
    begin
      if BankScreen then
       CloseBank;
      repeat
       if not InBankArea then
         begin
           MiddleToBank;
           WalkToBank;
           LowPlaceToBank;
         end;
       if (FindObject(x, y, AK_Bank, MSX1, MSY1, MSX2, MSY2)) then
        begin
          Clickmouse2(false);
          if not WaitOption('Bank B', 500) then
            BankEr;
          WaitFunc(@BankScreen, 10, 5000);
        end;
      until BankScreen;
      DepositAll;
      if GetMMLevels('run', s) < 60 then
        begin
          Withdraw(0, 0, 1);
          Withdraw(1, 0, 28);
        end else
          begin
            Withdraw(1,0,28);
          end;
      if not WaitInvMinCount(28, 5000) then
        BankEr;
    end;

    Thank you for your time.

  2. #2
    Join Date
    Apr 2007
    Location
    Estonia
    Posts
    156
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    NVM,
    Just describe what it should do, I'll try to fix it


    EDIT: Or maybe if it banks all after withdrawing then maybe WaitInvMinCount(28, 5000) doesn't work well, try replacing that line:
    SCAR Code:
    if not WaitInvMinCount(28, 5000) then
    To:
    SCAR Code:
    if (not(WaitFunc(@InvFull, 50, 5000))) then
    Last edited by neeger; 12-04-2012 at 02:32 AM.
    ROCK IS NOT A DEVILS WORK, ITS MAGICAL AND RAD!

  3. #3
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    I've been using WaitInvCount in other scripts and had no issue with it. Also, if the problem was that, it'd start the function all over again, triggering the CloseBank (which doesn't happen).

    Explaining what it does can be tricky but I'll try to:
    1- Check if you're in the banking area and moving there if you aren't.
    2- Searches for bankers once you're in the bank area.
    3- Gets out of the loop once the bankscreen is open.
    4- Depending on your energy level, it either withdraws only hides or 1 energy pot and hides.
    5- Wait to see if your inventory is full.
    6- Exit.

  4. #4
    Join Date
    Apr 2007
    Location
    Estonia
    Posts
    156
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Only problem I see is that WaitInvMinCount(28, 5000), because it starts it all over again(deposite, banking etc.).
    It fails on chacking inv, just use invfull if it withdraws 28 itmes.
    ROCK IS NOT A DEVILS WORK, ITS MAGICAL AND RAD!

  5. #5
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Can you do a debug?

    writeln('1');
    sdfsdfnsdfn
    writeln('2');

    So we know where exactly it gets stuck.

  6. #6
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    It's a very random problem. I tried a lot of writeln but it was a pain to figure out where it went wrong because of the randomness of it. I ended up rewriting the withdraw function to find out if it wasn't the include and I -think- that solved the problem. I was getting, somehow and randomly, some false negative. I'll post again later to tell if that definitely solved the issue or not.

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
  •