Page 1 of 2 12 LastLast
Results 1 to 25 of 29

Thread: Amount of an item?!?

  1. #1
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default Amount of an item?!?

    Does anyone know how to count the amount of a specific item in the inventory?

    All help appreciated!

  2. #2
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    GetAmountBox(InvBox(i))
    i = inventory slot number

    Do u mean this?

    Creds to DannyRS for this wonderful sig!

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

    Default

    Quote Originally Posted by jordantotty View Post
    Does anyone know how to count the amount of a specific item in the inventory?

    All help appreciated!
    I use this:
    Simba Code:
    GetAmountBox(InvBox(i));
    Where 'i' is the inventory slot.

    E: Aw man, third time today

    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
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Simba Code:
    GetAmountBox(InvBox(25)); // Gets the amount of an item in the specified inventory slot

    I'm not sure if there is an 07Scape adaptation in DannyRS's include, worth a try(: If not look up reading text with a bitmap


    Simba Code:
    function GetAmountBox(box: TBox): integer;
    var
      Col: TIntegerArray;
      X, Y, I: Integer;
      B: TBox;
      TPA: TPointArray;
      S: String;
    begin
      Result := 0;

      If Not FindColor(X, Y, srl_outline_black, box.x1, box.y1, box.x2, box.y2) then
        Exit;
      Inc(Result);
      Col := [65535, 65278, 16777215, 8453888];

      For I := 0 to High(Col) do
       If FindColor(X, Y, Col[I], box.x1, box.y1, box.x2, box.y2)then
       begin
         FindColors(TPA, Col[i], box.x1, box.y1, box.x2, box.y2);
         B := GetTPABounds(TPA);
         //SMART_DrawBoxEx(False, b, clYellow);
         B := IntToBox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
         S := GetTextAtExWrap(b.x1, b.y1, b.x2, b.y2, 0, 1, 1, Col[i], 0, StatChars);
         Result := StrToIntDef(GetNumbers(S), 1);
         Case I of
           2: Result := Result * 1000;
           3: Result := Result * 1000000;
         end;
         Exit;
       end;
    end;

    ^This is the function from SRL

    'd me while typing guys :P

  5. #5
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by -daazndagger- View Post
    I use this:
    Simba Code:
    GetAmountBox(InvBox(i));
    Where 'i' is the inventory slot.

    E: Aw man, third time today
    Quote Originally Posted by SRLKing View Post
    Simba Code:
    GetAmountBox(InvBox(25)); // Gets the amount of an item in the specified inventory slot


    'd me while typing guys :P
    I DOUBLE NINJA'd u guys

    there must be some kind of award for this

    Creds to DannyRS for this wonderful sig!

  6. #6
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by Sjoekeloe View Post
    I DOUBLE NINJA'd u guys
    Happened twice so far XD

    You are the helping

    E* The Helping cup XD

  7. #7
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Thanks!

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

    Default

    Quote Originally Posted by Sjoekeloe View Post
    I DOUBLE NINJA'd u guys
    Fine, you win.

    But, just realised, that this is in the 'old school' section. I too, am not sure if it's in Danny's include. It'd just be a matter of changing the font though I think. And if that's done then, all sweet
    Last edited by Press Play; 03-02-2013 at 05:13 AM. Reason: realised, not released, lol

    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]

  9. #9
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    w1:=GetAmountBox(InvBox(2));
    Returns 0, instead of 973!?

  10. #10
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Do you know where I can get p07 Stat chars?

  11. #11
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by jordantotty View Post
    Do you know where I can get p07 Stat chars?
    I don't know but try and make your own box. The coords could be off, since they are for RS2

    Creds to DannyRS for this wonderful sig!

  12. #12
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by jordantotty View Post
    Do you know where I can get p07 Stat chars?
    Just edit the boxes, are you using @DannyRS's include?

  13. #13
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Yes, please inform me on how to do that, !

  14. #14
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by jordantotty View Post
    Yes, please inform me on how to do that, !
    var
    Itemslot2: Tbox;

    ItemSlot2 := IntToBox(156,78,180,90); // those are random coords, just make your own box

    GetAmountBox(Itemslot2);

    Creds to DannyRS for this wonderful sig!

  15. #15
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Thanks, One more question, how does inttobox work?

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

    Default

    Quote Originally Posted by jordantotty View Post
    Thanks, One more question, how does inttobox work?
    Turns a group of 4 integers into a box:
    Simba Code:
    var
      B: TBox;

    B := IntToBox(x1, y1, x2, y2);

    x1, y1: coordinate of top left corner
    x1, y2: coordinate of bottom right corner

    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]

  17. #17
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    I've tried:

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(InvBox(2));
    WriteLn(w1);

    Returns 0

    _______________

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(Itemslot2);
    WriteLn(w1);

    Returns 0

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

    Default

    Quote Originally Posted by jordantotty View Post
    I've tried:

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(InvBox(2));
    WriteLn(w1);

    Returns 0

    _______________

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(Itemslot2);
    WriteLn(w1);

    Returns 0
    Looks like it's not finding the black outline of the item in your inventory. Try colour-picking the black outline of the item and putting that into the function:
    Simba Code:
    If Not FindColor(X, Y, srl_outline_black, box.x1, box.y1, box.x2, box.y2) then
        Exit;

    //Change to:

    If Not FindColor(X, Y, {PUT YOU COLOR HERE}, box.x1, box.y1, box.x2, box.y2) then
        Exit;


    E: Are you using DannyRS's 07 include?

    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]

  19. #19
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by jordantotty View Post
    I've tried:

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(InvBox(2));
    WriteLn(w1);



    Returns 0

    _______________

    ItemSlot2 := IntToBox(601,209,635,243);
    w1:=GetAmountBox(Itemslot2); //Also I believe this should be IntoStr as it is a numerical variable
    WriteLn(w1);

    Returns 0
    Appears to not be using the text reading properly, @ about it, I'm sure he'd be glad to help since it is his include(:

    E* It doesnt look like he is using the include as it would say P07_ before the commands, correct?

  20. #20
    Join Date
    Nov 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Yeah, im using @DannyRs include

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

    Default

    Quote Originally Posted by jordantotty View Post
    Yeah, im using @DannyRs include
    Are there such functions as ?
    Simba Code:
    P07_GetAmountBox();
    P07_InvBox();

    E: Maybe I should just download the dam include..

    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]

  22. #22
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by SRLKing View Post
    Appears to not be using the text reading properly, @ about it, I'm sure he'd be glad to help since it is his include(:

    E* It doesnt look like he is using the include as it would say P07_ before the commands, correct?
    Getamount nor invbox are not in the P07 Include

    Creds to DannyRS for this wonderful sig!

  23. #23
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by -daazndagger- View Post
    Are there such functions as ?
    Simba Code:
    P07_GetAmountBox();
    P07_InvBox();
    AS far as I know, this is what he should be using(:

    E* You are going to have to edit the functions yourself, I'd be happy to help you over pm

    'd me again Sjoe

  24. #24
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by SRLKing View Post
    AS far as I know, this is what he should be using(:

    E* You are going to have to edit the functions yourself, I'd be happy to help you over pm

    'd me again Sjoe
    Damn right I did!

    Maybe they are other fonts also, u should compare them.

    Creds to DannyRS for this wonderful sig!

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

    Default

    Okay, had a look at the include. Those functions don't exist ahah. Try this:
    Simba Code:
    function P07_GetAmountBox(box: TBox): integer;
    var
      Col: TIntegerArray;
      X, Y, I: Integer;
      B: TBox;
      TPA: TPointArray;
      S: String;
    begin
      Result := 0;

      If Not FindColor(X, Y, P07_outline_black, box.x1, box.y1, box.x2, box.y2) then
        Exit;
      Inc(Result);
      Col := [65535, 65278, 16777215, 8453888];

      For I := 0 to High(Col) do
       If FindColor(X, Y, Col[I], box.x1, box.y1, box.x2, box.y2)then
       begin
         FindColors(TPA, Col[i], box.x1, box.y1, box.x2, box.y2);
         B := GetTPABounds(TPA);
         //SMART_DrawBoxEx(False, b, clYellow);
         B := IntToBox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
         S := GetTextAtExWrap(b.x1, b.y1, b.x2, b.y2, 0, 1, 1, Col[i], 0, StatChars);
         Result := StrToIntDef(GetNumbers(S), 1);
         Case I of
           2: Result := Result * 1000;
           3: Result := Result * 1000000;
         end;
         Exit;
       end;
    end;

    If the statChars are the same, then you should be sweet. Otherwise... we can play the waiting game

    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]

Page 1 of 2 12 LastLast

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
  •