Results 1 to 4 of 4

Thread: ItemAmount

  1. #1
    Join Date
    Apr 2015
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default ItemAmount

    Hi,

    I'm writing my first script which buys buckets of sand from a shop. ItemAmount returns the correct value for any item amounts between 0-9. When the item amount is 10 however, ItemAmount returns 0. I tried editing the tolerence for the bitmap but that would not fix it either. ItemAmount will work for other items I'm trying to buy.

    The script I'm writing is using PascalScript because I used another person's script to build upon.

    Also I'm having issues with the DepositScreen function, It will not work at all for any coordinates I put in. I wrote another script (A smithing script at an anvil) that gets the textTPA of the SmithingScreen when the anvil is clicked, but I couldn't get DepositScreen to work by changing the coordinates.

    Any help would be great.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Have you given AeroLib a try? You can make what's called a TItem using either a DTM or Bitmap and later directly find the amount of that 'TItem' either in your inventory or in your bank screen. Here's an examples of finding the amount of an item in the inventory, the bank and on the mainscreen (presuming you want the shop amount):
    Simba Code:
    program new;
    {$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}

    var
      item_SandBucket : TItem;

    procedure loadVars();
    begin
      with item_SandBucket do
        DTM := DTMFromString('YOUR DTM STRING HERE');
    end;

    procedure freeGlobals();
    begin
      freeDTM(item_SandBucket.DTM);
    end;

    procedure grabItemAmounts();
    var
      P : TPoint;
    begin
      writeln('There are '+toStr(item_SandBucket.getAmount(True))+' sand buckets in the inventory');
      writeln('There are '+toStr(item_SandBucket.getAmount(False))+' sand buckets in the bank');

      if item_SandBucket.findIn(AREA_MS, P) then
        writeln('There are '+toStr(getItemAmount(P))+' sand buckets on the mainscreen (shop interface)');
    end;

    begin
      initAL();

      loadVars();
      addOnTerminate('freeGlobals');

      grabItemAmounts();
    end.

    Simple no?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    you can also do this with aerolib which it'll be easier:

    Simba Code:
    var
    itemamount: integer;

    procedure finditemamount;
    begin

      itemamount := getItemAmount(point(612,227)); // point where your item is
      // in case you dont know where the item will be, just make a DTM, colour, BMP search and get the point that way.
    end;

    just an alternative to what flight said
    Formerly known as Undorak7

  4. #4
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Also, I've already written a script that buys buckets of sand and soda ashe in AeroLib. You can find it here

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
  •