Results 1 to 11 of 11

Thread: WithdrawEx

  1. #1
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default WithdrawEx

    Simba Code:
    if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300)) then
            Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)]);
    If the option before Withdraw-X is a non-single digit number, say 22, and u intend to withdraw 2, it will withdraw 22 instead as it doesn't check beyond "w-2".
    Possible fix would be to check that the text after the (Amount) is blank, or 2 space after it is an orange text.

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    So you are saying.
    If before withdraw X you have withdraw 22 (from previous play)
    And then you use withdraw X to withdraw 2, it will pick the 22?

    Yeah that makes sense. Good catch.
    Bet it rarely happens though, but good

  3. #3
    Join Date
    Jul 2007
    Location
    Melbourne, Victoria, Australia.
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    So you are saying.
    If before withdraw X you have withdraw 22 (from previous play)
    And then you use withdraw X to withdraw 2, it will pick the 22?

    Yeah that makes sense. Good catch.
    Bet it rarely happens though, but good
    Exactly what he's saying. Hmm no its quite a common problem :/
    Last known as Jonno.

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Just change your last withdraw X to something else to fix it?

  5. #5
    Join Date
    Jul 2007
    Location
    Melbourne, Victoria, Australia.
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    Guess I'll have to do that, always take the easy way out.
    Last known as Jonno.

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Yeah its a rather common problem:
    Quote Originally Posted by Jonno View Post
    Oh no not physically, its just that Withdraw "x" which is 20 prayer pots is the last value taken out and when the script finishes its round that "x" becomes 20 and so it takes out 20 pouches ^.^
    This is what i do in my DomDag script to reset the X option to single digit:
    Simba Code:
    MouseBankSlot(1,mouse_Right);
        InvItems:=InvCount;
        if WaitOptionMulti(['Withdraw-X', 'w-X'], 1500) then
        begin
          X := GetSystemTime + 10000;
          while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do   //Ripped from include
           Wait(50);
          HumanWait(20,110,340);
          TypeSend(IntToStr(RandomRange(2,4)));
          MarkTime(InvWait);
          repeat
            wait(RandomRange(60,220));
          until (InvCount>InvItems) or (TimeFromMark(InvWait)>3000);
    And i just realize that i'll have to do this every time before withdrawing any item since their bank settings may be to withdraw >10 items for the previous item. (Or i can check and only do this if the previous withdraw quantity is indeed >10), or a better solution would be to edit the include such that it always use X to withdraw any amount that is not 1,5,10.


    Nevertheless i think the problem should still be fixed as other scripters may not be aware of the issue and hence unknowingly inducing error in their scripts.

  7. #7
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    You could do.

    Simba Code:
    Right Click Item
    If not WaitOption('w 2 ', 1000) Then //NOTICE THE SPACE AFTER THE TWO, THAT WILL STOP FROM PICKING 22
    Begin
      WaitOption('X', 1000);
      TypeSend('2');
    End;

    ^Not 100% real code, but you get it ya?

  8. #8
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Happens to me alot, I just set my withdraw x to something different.

  9. #9
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Had this problem before.. The actual fix is:
    Simba Code:
    'Withdraw-' + IntToStr(Amount) + ' '

    The space after is required. When the OCR looks for the options, it will look for 2 space nothing. If you put 22, it will look for 22 space nothing. The difference will be the space so that it does knows the difference between 2 and 22.

    Example:
    Its the difference between Pos(....) or PosEx(....) to find the position of a value in a string. This can cause problems if that value isn't a unique/single value. This is why Regex's are supposed to be used (ExecRegExpr) but since no one is going to re-write it, just put the space to distinguish singularity.

    Choose Options still uses Pos -_-
    Last edited by Brandon; 06-17-2012 at 03:39 PM.
    I am Ggzz..
    Hackintosher

  10. #10
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Proposed Changes:
    Simba Code:
    (*
    WithdrawEx
    ~~~~~~~~~~

    .. code-block:: pascal

        function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;

    Withdraws Amount at Column/Row.

    .. note::

        Author: Starblaster100, Town, Wizzup? and Narcle, small fixes by r!ch!e & EvilChicken!
        Last Modified: Unknown

    Example:

    .. code-block:: pascal

        WithdrawEx(1, 3, 28, ['ron ore', 'ore', 'on or']);
    *)

    function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
    var
      BBox: TBox;
      X, Y: Integer;
    begin

      Result := False;

      if(Amount < -1)then
        begin
          srl_Warn('WithdrawEx', 'Invalid Selection for amount: '+IntToStr(Amount), warn_AllVersions);
          exit;
        end;
       
      FixBank;

      BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
      GetMousePos(X, Y);
      if (not PointInBox(Point(X, Y), BBox)) then
        MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_move);

      if (Length(Uptexts) > 0) then
        if (not WaitUptextMulti(Uptexts, 500+Random(200))) then
          Exit;

      Case Amount of
        -1 : begin
               ClickMouse2(mouse_Right);
               if (WaitOptionMultiEx(['Withdraw-All but', 'l b'], 'All', Nothing, 300+Random(200))) then
                 Result := ChooseOptionMulti(['Withdraw-All but', 'l b']);
               exit;
             end;
        0 : begin
              ClickMouse2(mouse_Right);
              if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300+Random(200))) then
                Result := ChooseOptionMulti(['Withdraw-All', 'w-A']);
              exit;
            end;
        1 : begin
              ClickMouse2(mouse_Left);
              Result := True;
              Wait(RandomRange(250, 550));
              exit;
            end;
      end;

      ClickMouse2(mouse_Right);

      if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)], 'All', Nothing, 300+Random(200))) then
        begin
          Result := ChooseOptionMulti(['Withdraw-' + IntToStr(Amount)+' ', 'w-' + IntToStr(Amount)+' ']);
          exit;
        end;

      if (Amount > 1) then
      begin
        if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], nothing)) then
          MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

        if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
        begin
           X := GetSystemTime + 10000;
           while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
             Wait(Random(50));
           Wait(RandomRange(75, 400));
           TypeSend(IntToStr(Amount));
           Result := True;
        end;
      end;
    end;
    I got rid of a lot of the ifs and put in a case statement to neaten things up...
    Last edited by putonajonny; 06-17-2012 at 03:55 PM.

  11. #11
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    A simple change to ChooseOptions will suffice:

    Instead of doing Pos or PosEx just do ExecRegExpr(PreferredOption, ListOfOptionsFound);

    That's it. If this happens to any other functions, they will automatically be fixed rather than changing every single one specifically to have a space.
    I am Ggzz..
    Hackintosher

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
  •