Results 1 to 8 of 8

Thread: Withdraw

  1. #1
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default Withdraw

    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;
      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)) then
          Exit;

      if (Amount = 1) then
        ClickMouse2(mouse_left)
      else
        ClickMouse2(mouse_right);
      if (Amount = 1) then
      begin
        Result := True;
        Wait(RandomRange(250, 550));
        Exit;
      end;

      if (Amount = -1) then
        Result := WaitOptionMulti(['Withdraw-All but', 'l b'], 300)
      if (Amount = 0) then
        Result := WaitOptionMulti(['Withdraw-All', 'w-A'], 300)
      else
        Result := WaitOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)] , 300);

      if (not (Result)) and (Amount > 0) then
      begin
        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(50);
           Wait(RandomRange(75, 400));
           TypeSend(IntToStr(Amount));
           Result := True;
        end;
      end;
    end;
    but putting -1 the script would choose "Withdraw-All but one"

    ~shut

  2. #2
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Committed to SRL5.

  3. #3
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Simba Code:
    while not FindColorBox(x, y, srl_outline_black, BankIndexToMSBox(Players[CurrentPlayer].Integers[P_BANK_SLOT])) do
        begin
          Wait(200+Random(150*LaggFactor));
        end;
    This is an excerpt of a fix from my Fletching script, which is called just before I withdraw my items. Could this be used somewhere in the beginning of this function perhaps? It's similar to the function ExistsItem(I: Integer): Boolean; function, except for the bank. I know it's the scripter's job to take care of such things, but since it checks for UpText, why not also check for the black outline? So maybe it could look like:

    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, T: Integer;
    begin
      Result := False;
      FixBank;

      BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
      T := GetSystemTime + 500;
      while not FindColor(x, y, srl_outline_black, BBox.X1, BBox.Y1, BBox.X2, BBox.Y2) and (GetSystemTime < T) do
        Wait(20 + Random(10));

      if not FindColor(x, y, srl_outline_black, BBox.X1, BBox.Y1, BBox.X2, BBox.Y2) then Exit;

      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)) then
          Exit;

      if (Amount = 1) then
        ClickMouse2(mouse_left)
      else
        ClickMouse2(mouse_right);
      if (Amount = 1) then
      begin
        Result := True;
        Wait(RandomRange(250, 550));
        Exit;
      end;

      if (Amount = -1) then
        Result := WaitOptionMulti(['Withdraw-All but', 'l b'], 300)
      if (Amount = 0) then
        Result := WaitOptionMulti(['Withdraw-All', 'w-A'], 300)
      else
        Result := WaitOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)] , 300);

      if (not (Result)) and (Amount > 0) then
      begin
        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(50);
           Wait(RandomRange(75, 400));
           TypeSend(IntToStr(Amount));
           Result := True;
        end;
      end;
    end;
    It's really messy, but you get my idea?

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  4. #4
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by -daazndagger- View Post
    Simba Code:
    while not FindColorBox(x, y, srl_outline_black, BankIndexToMSBox(Players[CurrentPlayer].Integers[P_BANK_SLOT])) do
        begin
          Wait(200+Random(150*LaggFactor));
        end;
    This is an excerpt of a fix from my Fletching script, which is called just before I withdraw my items. Could this be used somewhere in the beginning of this function perhaps? It's similar to the function ExistsItem(I: Integer): Boolean; function, except for the bank. I know it's the scripter's job to take care of such things, but since it checks for UpText, why not also check for the black outline? So maybe it could look like:

    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, T: Integer;
    begin
      Result := False;
      FixBank;

      BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
      T := GetSystemTime + 500;
      while not FindColor(x, y, srl_outline_black, BBox.X1, BBox.Y1, BBox.X2, BBox.Y2) and (GetSystemTime < T) do
        Wait(20 + Random(10));

      if not FindColor(x, y, srl_outline_black, BBox.X1, BBox.Y1, BBox.X2, BBox.Y2) then Exit;

      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)) then
          Exit;

      if (Amount = 1) then
        ClickMouse2(mouse_left)
      else
        ClickMouse2(mouse_right);
      if (Amount = 1) then
      begin
        Result := True;
        Wait(RandomRange(250, 550));
        Exit;
      end;

      if (Amount = -1) then
        Result := WaitOptionMulti(['Withdraw-All but', 'l b'], 300)
      if (Amount = 0) then
        Result := WaitOptionMulti(['Withdraw-All', 'w-A'], 300)
      else
        Result := WaitOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)] , 300);

      if (not (Result)) and (Amount > 0) then
      begin
        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(50);
           Wait(RandomRange(75, 400));
           TypeSend(IntToStr(Amount));
           Result := True;
        end;
      end;
    end;
    It's really messy, but you get my idea?
    If we do that I rather just add a GetAmount check on it. So basically it waits for the GetAmount to come up (which includes black outline check). If its false then result := false; would make it way more useful.

    (with draw all would have to be excluded from amount check)
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  5. #5
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    If we do that I rather just add a GetAmount check on it. So basically it waits for the GetAmount to come up (which includes black outline check). If its false then result := false; would make it way more useful.

    (with draw all would have to be excluded from amount check)
    Yes, I like this idea - might as well implement the whole lot of checks right. Yeah, I didn't know where to add in the Result:= false, so instead I just made it exit the function. It's messy as I said

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  6. #6
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    If we do that I rather just add a GetAmount check on it. So basically it waits for the GetAmount to come up (which includes black outline check). If its false then result := false; would make it way more useful.

    (with draw all would have to be excluded from amount check)
    Why would that make it more useful? I can't really think of why WithdrawEx would need the amount of the item. =\

  7. #7
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Why would that make it more useful? I can't really think of why WithdrawEx would need the amount of the item. =\
    No, like if you put an exact amount like 1, 5, 10, 14 etc. it'll check to make sure there's at least that much in the spot. If its set to 0 or -1 it'll ignore this check.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    No, like if you put an exact amount like 1, 5, 10, 14 etc. it'll check to make sure there's at least that much in the spot. If its set to 0 or -1 it'll ignore this check.
    Ah yes, good point.

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
  •