Results 1 to 25 of 25

Thread: DepositAll

  1. #1
    Join Date
    Jan 2011
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default DepositAll

    Coords were changed with today's update and the addition of a deposit-from-coin-pouch button.

    Here is the fixed DepositAll:

    Simba Code:
    function DepositAll: Boolean;
    var
      T, X, Y: Integer;
      BScreen, DScreen: Boolean;
    begin
      Result := false;
      BScreen := BankScreen;
      if (not(BScreen)) then
        DScreen := DepositScreen;
      if (BScreen) or (DScreen) then
        if (InvCount > 0) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) then
        begin
          Mouse(369 - 59 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True); // This is what I changed
          Wait(200 + Random(300));
          T := GetSystemTime;
          while (InvCount > 0) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) and (GetSystemTime - T < 2000) do
            Wait(100);
          Result := (InvEmpty) or (not(FindColor(X, Y, srl_outline_black, 98, 68, 436, 257)) and (DScreen));
        end else begin
          srl_Warn('DepositAll', 'No items to deposit ', warn_AllVersions);
          result := true;
        end;
    end;

    and a proposed DepositCoins

    Simba Code:
    function DepositCoins: Boolean;
    var
      T, X, Y: Integer;
      BScreen, DScreen: Boolean;
    begin
      Result := false;
      BScreen := BankScreen;
      if (not(BScreen)) then
        DScreen := DepositScreen;
      if (BScreen) or (DScreen) then
        if (true) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) then
        begin
          Mouse(405 - 58 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True); // This is what I changed
          Wait(200 + Random(300));
          T := GetSystemTime;
          while (not(FindChatBoxText('You deposit', 8, clBlack))) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) and (GetSystemTime - T < 2000) do
            Wait(100);
          Result := (FindChatBoxText('You deposit', 8, clBlack)) or (not(FindColor(X, Y, srl_outline_black, 98, 68, 436, 257)) and (DScreen));
        end;
    end;
    Last edited by legoace; 01-04-2012 at 04:22 PM. Reason: Fixed suggestions to work with DepositScreens

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

    Default

    Your DepositAll fix was committed, though I don't like the DepositCoins. I think we should have it, but it's the exact same as DepositAll with one line changed. It's just unnecessary repeated code.

    I'm thinking something like QuickDeposit that will handle all the "quick buttons" in the bank (All, Coins, Equipment, Summoning), then we can have DepositAll, DepositCoins, etc. call QuickDeposit so scripts won't break. Someone want to do it?

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

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

    Default

    Simba Code:
    const
      SRL_DEPOSIT_ALL = 0;
      SRL_DEPOSIT_COINS = 1;
      SRL_DEPOSIT_EQUIPMENT = 2;
      SRL_DEPOSIT_FOLLOWER = 3;

    function QuickDeposit(Which: Integer): Boolean;
    var
      T, X, Y: Integer;
      BScreen, DScreen: Boolean;
    begin
      Result := false;
      BScreen := BankScreen;
      if (not(BScreen)) then
        DScreen := DepositScreen;
      if (BScreen) or (DScreen) then
        if (true) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) then
        begin
          case Lowercase(Which) of
            SRL_DEPOSIT_ALL: Mouse(369 - 58 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True);
            SRL_DEPOSIT_COINS: Mouse(405 - 58 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True);
            SRL_DEPOSIT_EQUIPMENT: Mouse(441 - 58 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True);
            SRL_DEPOSIT_FOLLOWER: Mouse(477 - 58 * Integer(DScreen), 307 - 29 * Integer(DScreen), 15, 10, True);
          end;
          Wait(200 + Random(300));
          T := GetSystemTime;
          while (not(FindChatBoxText('You deposit', 8, clBlack))) or (FindColor(X, Y, srl_outline_black, 98, 68, 436, 257) and (DSCreen)) and (GetSystemTime - T < 2000) do
            Wait(100);
          Result := (FindChatBoxText('You deposit', 8, clBlack)) or (not(FindColor(X, Y, srl_outline_black, 98, 68, 436, 257)) and (DScreen));
        end;
    end;

    function DepositAll: Boolean;
    begin
      Result:= QuickDeposit(SRL_DEPOSIT_ALL);
    end;

    function DepositCoins: Boolean;
    begin
      Result:= QuickDeposit(SRL_DEPOSIT_COINS);
    end;

    function DepositEquipment: Boolean;
    begin
      Result:= QuickDeposit(SRL_DEPOSIT_EQUIPMENT);
    end;

    function DepositFollower: Boolean;
    begin
      Result:= QuickDeposit(SRL_DEPOSIT_FOLLOWER);
    end;

    ~shut
    Last edited by Shuttleu; 01-04-2012 at 07:42 PM.

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

    Default

    Should probably change to use constants as that's going to be the standard for future SRL versions.
    Progress Report:
    SRL_DEPOSIT_ALL = 0;
    SRL_DEPOSIT_COINS = 1;
    // etc.
    Nice job, though. I'll add it later.

  6. #6
    Join Date
    Jan 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    where to make this change !?

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

  8. #8
    Join Date
    Jan 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    shuttleu where to edit this lines , or how to make this change i cant run the bot it keeps clicking on deposit money :S !

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

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

    Default

    Or update to SRL5.

  11. #11
    Join Date
    Jan 2011
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Shut, you can't just use if(FindChatBoxText('You deposit', 8, clBlack)) to check for success for ALL of those, as far as I know that text only appears when depositing all coins, maybe equipment. It does NOT appear for the normal Deposit All button.

  12. #12
    Join Date
    Dec 2011
    Location
    USA USA USA!!!
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    where can I find the SRL5 update?

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

    Default

    Quote Originally Posted by legoace View Post
    Shut, you can't just use if(FindChatBoxText('You deposit', 8, clBlack)) to check for success for ALL of those, as far as I know that text only appears when depositing all coins, maybe equipment. It does NOT appear for the normal Deposit All button.
    Probably don't need it at all. If the button is clicked, it'll deposit everything (unless the bank is full I suppose).

    Quote Originally Posted by TwoClover View Post
    where can I find the SRL5 update?
    It's in the updater so just make sure your SRL is updated and you'll have it.

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

    Default

    How's this look? I made it into a procedure because the result didn't work for every deposit method, plus it's always going to click the right spot. DepositAll() now results true if the inventory is full, and I'm not going to add the other deposit methods because scripters should just use QuickDeposit and can come up with their own result if they want to. The only reason I'm keeping DepositAll is so it doesn't break scripts.
    Simba Code:
    (*
    QuickDeposit
    ~~~~~~~~~~~~

    .. code-block:: pascal

        function QuickDeposit(Which: Integer): Boolean;

    Uses the quick deposit buttons in the bottom right of the bank.  Valid
    arguments for 'Which' are:
        * SRL_DEPOSIT_ALL
        * SRL_DEPOSIT_COINS
        * SRL_DEPOSIT_EQUIPMENT
        * SRL_DEPOSIT_FOLLOWER

    .. note::

        Author: ZephyrsFury & Quickmarch & Shuttleu
        Last Modified: January 08, 2012 by Coh3n

    Example:

    .. code-block:: pascal

        QuickDeposit(SRL_DEPOSIT_COINS);
    *)

    const
      SRL_DEPOSIT_ALL = 0;
      SRL_DEPOSIT_COINS = 1;
      SRL_DEPOSIT_EQUIPMENT = 2;
      SRL_DEPOSIT_FOLLOWER = 3;

    procedure QuickDeposit(Which: Integer);
    var
      StartX: Integer;
    begin
      if (BankScreen) or (DepositScreen) then
      begin
        case Which of
          SRL_DEPOSIT_ALL:       StartX := 365;
          SRL_DEPOSIT_COINS:     StartX := 400;
          SRL_DEPOSIT_EQUIPMENT: StartX := 435;
          SRL_DEPOSIT_FOLLOWER:  StartX := 475;

          else
            SRL_Warn('QuickDeposit', 'Invalid deposit method ', WARN_ALLVERSIONS);
        end;

        Mouse(StartX - 58 * Integer(DepositScreen), 307 - 29 * Integer(DepositScreen), 15, 10, True);
        Wait(200 + Random(300));
      end;
    end;

    (*
    DepositAll
    ~~~~~~~~~~

    .. code-block:: pascal

        function DepositAll: Boolean;

    Deposits all items in your inventory.

    .. note::

        Author: Shuttleu
        Last Modified: January 08, 2012 by Coh3n

    Example:

    .. code-block:: pascal

        DepositAll();
    *)

    function DepositAll: Boolean;
    begin
      QuickDeposit(SRL_DEPOSIT_ALL);
      Result := WaitFunc(@InvEmpty, 50, 3000);
    end;
    Does anything seem wrong with that?
    Last edited by Coh3n; 01-09-2012 at 12:54 AM.

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

    Default

    how about adding a inv item count?

    that way it wont click the button if the inv is already empty

    ~

    EDIT: so change this
    if (BankScreen) or (DepositScreen) then
    to this
    if (((BankScreen) or (DepositScreen)) and (not InvEmpty)) then
    Last edited by Shuttleu; 01-09-2012 at 12:52 AM.

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

    Default

    Because you can still deposit coins/equipment/follower if the inventory is empty.

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

    Default

    Quote Originally Posted by Coh3n View Post
    Because you can still deposit coins/equipment/follower if the inventory is empty.
    hmmm... good point

    so how about this?

    Simba Code:
    procedure QuickDeposit(Which: Integer);
    var
      StartX: Integer;
    begin
      if (BankScreen) or (DepositScreen) then
      begin
        case Which of
          SRL_DEPOSIT_ALL:       StartX := 365;
          SRL_DEPOSIT_COINS:     StartX := 400;
          SRL_DEPOSIT_EQUIPMENT: StartX := 435;
          SRL_DEPOSIT_FOLLOWER:  StartX := 475;

          else
            SRL_Warn('QuickDeposit', 'Invalid deposit method ', WARN_ALLVERSIONS);
        end;

        if (Which = SRL_DEPOSIT_ALL) and (InvEmpty) then
          Exit;

        Mouse(StartX - 58 * Integer(DepositScreen), 307 - 29 * Integer(DepositScreen), 15, 10, True);
        Wait(200 + Random(300));
      end;
    end;

    ~shut

    EDIT: i think this would be better actually
    Simba Code:
    procedure QuickDeposit(Which: Integer);
    var
      StartX: Integer;
    begin
      if (BankScreen) or (DepositScreen) then
      begin
        case Which of
          SRL_DEPOSIT_ALL:       if InvEmpty then Exit else StartX := 365;
          SRL_DEPOSIT_COINS:     StartX := 400;
          SRL_DEPOSIT_EQUIPMENT: StartX := 435;
          SRL_DEPOSIT_FOLLOWER:  StartX := 475;

          else
            SRL_Warn('QuickDeposit', 'Invalid deposit method ', WARN_ALLVERSIONS);
        end;    

        Mouse(StartX - 58 * Integer(DepositScreen), 307 - 29 * Integer(DepositScreen), 15, 10, True);
        Wait(200 + Random(300));
      end;
    end;
    Last edited by Shuttleu; 01-09-2012 at 01:03 AM.

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

    Default

    Or the scripter can just do:
    Simba Code:
    if (not InvEmpty) then
      DepositAll();
    Or I can just change DepositAll to:
    Simba Code:
    function DepositAll: Boolean;
    begin
      if (InvEmpty) then
      begin
        Result := True;
        Exit;
      end;

      QuickDeposit(SRL_DEPOSIT_ALL);
      Result := WaitFunc(@InvEmpty, 50, 3000);
    end;
    ^ I think I'll do that.

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

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

    Default

    Committed in the newest version.

  21. #21
    Join Date
    Dec 2011
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have the latest version of SRL5, and yet when I run a script the cursor still clicks the Deposit Coins button. I am using the herb cleaner script here:
    http://villavu.com/forum/showthread.php?t=71073

    Could someone help please?

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

    Default

    Quote Originally Posted by Grihmm View Post
    I have the latest version of SRL5, and yet when I run a script the cursor still clicks the Deposit Coins button. I am using the herb cleaner script here:
    http://villavu.com/forum/showthread.php?t=71073

    Could someone help please?
    Near the top of the script if the includes are .scar files then it is out dated and use SRL4 still.
    (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.

  23. #23
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Hello Just now My DepositAll Does not work I dont think.. i made sure by manually entering the coords and mouse true and that worked so it must have been depositall.. it is 10:12 pm Pacific time, good day.


    strangely enough it was working a few hours ago when i was testing.?>?>?>?>/.

  24. #24
    Join Date
    Dec 2011
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I forgot to mention, I changed the .scar's to .simba's. So it should be working right? :S

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

    Default

    It does work. I've tested myself multiple times.

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
  •