Results 1 to 12 of 12

Thread: Need quick help on withdrawing an item from the bank

  1. #1
    Join Date
    Feb 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default Need quick help on withdrawing an item from the bank

    I have read the comments on the banking page, and every time I think I understand how to write the line, I geta syntax error.
    I just need someone who successfully uses: WithdrawItem to show me how the line is correctly written

    This is what I have and it gives me a type mismatch.

    Simba Code:
    Procedure Banking;
     Var
      dpick: Integer;

     Begin
      dpick := DTMFromString('mbQAAAHicY2VgYMhmYmBIB+IaIE4E4iIgFmdkYOAAYkkgVgNiHiBmYGDCgjEBIxYMBgD4aAKv');

      OpenBankQuiet('eb');
      DepositAll;
      WithdrawItem('dpick', 922984, [1], ['rag', 'ick'], 6);



     End;

  2. #2
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Simba Code:
    procedure Banking;
    begin
      OpenBankQuiet('eb');
      DepositAll;
      WithdrawItem(922984, 'color', 1, 'rag', [6]);
    end;

    Make sure you have the correct types for each argument.
    Simba Code:
    function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;

    There's no TStringArray for this specific method.

    Also, I don't see why you declare a dtm when you don't use it (DPick).

  4. #4
    Join Date
    Feb 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Show me what the parameters are and I will tell you
    This is what it shows in the notes for this function
    Simba Code:
    (*
    WithdrawItem
    ~~~~~~~~~~~~

    .. code-block:: pascal

        function WithdrawItem(Ident: integer; IdentType: string; Amount: integer;
                               UpText: TStringArray; Tol: TIntegerArray): boolean;

    Withdraws an item using WithdrawItemEx, but removes the Index check.

    .. note::

        Author: Nava2
        Last Modified: Unknown

    Example:

    .. code-block:: pascal

        if WithdrawItem(theColor, 'color', 27, ['ew log', 'ew l'], [3]) then
        CloseBank;
    *)

  5. #5
    Join Date
    Feb 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    But I am using it, the dtm is called dpick, I'm nt trying to withdraw by column and row but by dtm and color
    Quote Originally Posted by Le Jingle View Post
    Simba Code:
    procedure Banking;
    begin
      OpenBankQuiet('eb');
      DepositAll;
      WithdrawItem(922984, 'color', 1, 'rag', [6]);
    end;

    Make sure you have the correct types for each argument.
    Simba Code:
    function WithdrawItem(Ident: integer; IdentType: string; Amount: integer; UpText: String; Tol: TIntegerArray): boolean;

    There's no TStringArray for this specific method.

    Also, I don't see why you declare a dtm when you don't use it (DPick).

  6. #6
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    withdrawitem(dpick,'dtm',28,['rag', 'ick'],[]);

    replace the 28 with however many you want to withdraw. Just doing this on comp not sure if it compiles

  7. #7
    Join Date
    Feb 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    yet another type mismatch. Guess you use a different w/d method than this?

    Awesome and thanks I'll give it a whirl
    Quote Originally Posted by Ashaman88 View Post
    withdrawitem(dpick,'dtm',28,['rag', 'ick'],[]);

    replace the 28 with however many you want to withdraw. Just doing this on comp not sure if it compiles
    Last edited by Lisafishes; 03-05-2013 at 09:05 PM.

  8. #8
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by Lisafishes View Post
    yet another type mismatch. Guess you use a different w/d method than this?

    Awesome and thanks I'll give it a whirl
    Yeah sorry I can do it once I get home, don't have simba to play with at work. If nobody tells you how before then I'll let you know. But no I normally just use withdraw

  9. #9
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Asha had it right with the exception that, as I mentioned previousley, you can only have a string uptext.

    For example, a string, is:
    Simba Code:
    var
      s : string;
    begin
      s := 'dragon flying purple eater';
      writeln(s);
    end.

    whereas a TStringArray (the parameter that is not accepted as UpText for this function call) is:
    Simba Code:
    var
      sArr : TStringArray;
    begin
      sArr := ['hi', 'how', 'are', 'you'];
      writeln(sArr);
    end.

    In the above examples, a sArr is a TStringArray, or an array of string type.
    This is different from having a single string, s.

    THUS!
    When making the Banking procedure (for your original query), we can go about many ways, but two interesting ideas in particular:
    1. Use a single string to match upText
    Simba Code:
    procedure Banking;
    var
      DPick : Integer;
    begin
      DPick := DTMFromString('mbQAAAHicY2VgYMhmYmBIB+IaIE4E4iIgFmdkYOAAYkkgVgNiHiBmYGDCgjEBIxYMBgD4aAKv');
      OpenBankQuiet('eb');
      DepositAll;
      WithdrawItem(DPick, 'dtm', 1, 'Dragon pickaxe', []);
      FreeDTM(DPick);
    end;

    2. (loop through an array of string (aka a TStringArray)
    Simba Code:
    procedure Banking;
    var
      DPick, i : Integer;
      UpTexts : TStringArray;
    begin
      DPick := DTMFromString('mbQAAAHicY2VgYMhmYmBIB+IaIE4E4iIgFmdkYOAAYkkgVgNiHiBmYGDCgjEBIxYMBgD4aAKv');
      OpenBankQuiet('eb');
      DepositAll;

      UpTexts := ['rag', 'ick', 'ragon', 'ickaxe', 'Dragon pickaxe'];

      for i := 0 to high(UpTexts) do
        if WithDrawItem(DPick, 'dtm', 1, UpTexts[i], []) then
          break;

      FreeDTM(DPick);
    end;

    Explanation:
    In the first snippet, you look for the exact match, of a single string, s.
    In the second snippet, you iterate through your array of string (multiple), or TStringArray, calling WithdrawItem with a new string value (indicated by the current index being iterated through within the for loop), testing it for that uptext.

    In my opinion, I'd recommend either creating your own custom function based off of the second example, working in a TStringArray argument parameter. This could be implemented very similar to how the current withdrawItemEx function works, given the exception you change the internal line inside WithdrawItemEx (because WithDrawItem calls this), from if WaitUpText(UpText, 300) then to use the function, WaitUpTextMulti(S: TStringArray; Time: Integer).

    Nonetheless, the original snippet I shared will still obtain the outcome you desired.

    Cheers,
    Lj

  10. #10
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  11. #11
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    Lame why does include say array then ? Is it lies!?
    Yes I guess it does (just realized that now that you point it out), so you were setup!! (just joking ofc ) You had it correct, given the information from the function description and the lack of access to the internal functionality of the function.

  12. #12
    Join Date
    Feb 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Thankyou for that very informative answer, I do greatly appreciate the help, haven't played with scripting in many years, definately rusty.
    Quote Originally Posted by Le Jingle View Post
    Asha had it right with the exception that, as I mentioned previousley, you can only have a string uptext.

    For example, a string, is:
    Simba Code:
    var
      s : string;
    begin
      s := 'dragon flying purple eater';
      writeln(s);
    end.

    whereas a TStringArray (the parameter that is not accepted as UpText for this function call) is:
    Simba Code:
    var
      sArr : TStringArray;
    begin
      sArr := ['hi', 'how', 'are', 'you'];
      writeln(sArr);
    end.

    In the above examples, a sArr is a TStringArray, or an array of string type.
    This is different from having a single string, s.

    THUS!
    When making the Banking procedure (for your original query), we can go about many ways, but two interesting ideas in particular:
    1. Use a single string to match upText
    Simba Code:
    procedure Banking;
    var
      DPick : Integer;
    begin
      DPick := DTMFromString('mbQAAAHicY2VgYMhmYmBIB+IaIE4E4iIgFmdkYOAAYkkgVgNiHiBmYGDCgjEBIxYMBgD4aAKv');
      OpenBankQuiet('eb');
      DepositAll;
      WithdrawItem(DPick, 'dtm', 1, 'Dragon pickaxe', []);
      FreeDTM(DPick);
    end;

    2. (loop through an array of string (aka a TStringArray)
    Simba Code:
    procedure Banking;
    var
      DPick, i : Integer;
      UpTexts : TStringArray;
    begin
      DPick := DTMFromString('mbQAAAHicY2VgYMhmYmBIB+IaIE4E4iIgFmdkYOAAYkkgVgNiHiBmYGDCgjEBIxYMBgD4aAKv');
      OpenBankQuiet('eb');
      DepositAll;

      UpTexts := ['rag', 'ick', 'ragon', 'ickaxe', 'Dragon pickaxe'];

      for i := 0 to high(UpTexts) do
        if WithDrawItem(DPick, 'dtm', 1, UpTexts[i], []) then
          break;

      FreeDTM(DPick);
    end;

    Explanation:
    In the first snippet, you look for the exact match, of a single string, s.
    In the second snippet, you iterate through your array of string (multiple), or TStringArray, calling WithdrawItem with a new string value (indicated by the current index being iterated through within the for loop), testing it for that uptext.

    In my opinion, I'd recommend either creating your own custom function based off of the second example, working in a TStringArray argument parameter. This could be implemented very similar to how the current withdrawItemEx function works, given the exception you change the internal line inside WithdrawItemEx (because WithDrawItem calls this), from if WaitUpText(UpText, 300) then to use the function, WaitUpTextMulti(S: TStringArray; Time: Integer).

    Nonetheless, the original snippet I shared will still obtain the outcome you desired.

    Cheers,
    Lj

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •