Results 1 to 22 of 22

Thread: Amount.Scar GetAmount(); fix

  1. #1
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default Amount.Scar GetAmount(); fix

    I had to update the Color for the text and since the color seems to now be static I changed 'Col' from a TIntegerArray to an Integer; Seems like the color should be a constant anyways?

    I've tested multiple times and it's worked every time.

    Old version:
    SCAR Code:
    {*******************************************************************************
    function GetAmount(ItemX, ItemY: Integer): Integer;
    By: Zeph, N1ke & Narcle
    Description: Returns the amount of an item at coordinates (ItemX, ItemY).
      Returns approximate values for 'K' and 'M'.
    *******************************************************************************}

    function GetAmount(ItemX, ItemY: Integer): 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, ItemX-30, ItemY-30, ItemX+30, ItemY+30)then
        Exit;
      Inc(Result);
      Col := [65535, 16777215, 8453888];
      For I:=0 to 2 do
       If FindColor(X, Y, Col[I], ItemX-22, ItemY-22, ItemX+22, ItemY+22)then
       begin
         FindColors(TPA, Col[i], ItemX-22, ItemY-22, ItemX+22, ItemY+22);
         B := GetTPABounds(TPA);
         S := Trim(GetTextAtEx(B.X1-1, B.Y1-1, 0, StatChars, False, False, 0, 1, Col[I], 5, True, tr_AllChars));
         Result := StrToIntDef(GetNumbers(S), 1);
         Case I of
           1: Result := Result * 1000;
           2: Result := Result * 1000000;
         end;
         Exit;
       end;
    end;
    Fix:
    SCAR Code:
    {*******************************************************************************
    function GetAmount(ItemX, ItemY: Integer): Integer;
    By: Zeph, N1ke & Narcle
    Description: Returns the amount of an item at coordinates (ItemX, ItemY).
      Returns approximate values for 'K' and 'M'.
    *******************************************************************************}

    function GetAmount(ItemX, ItemY: Integer): 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, ItemX-30, ItemY-30, ItemX+30, ItemY+30)then
        Exit;
      Inc(Result);
      Col := [65535, 65278, 16777215, 8453888];
      For I:=0 to 3 do
       If FindColor(X, Y, Col[i], ItemX-22, ItemY-22, ItemX+22, ItemY+22)then
       begin
         FindColors(TPA, Col[i], ItemX-22, ItemY-22, ItemX+22, ItemY+22);
         B := GetTPABounds(TPA);
         S := Trim(GetTextAtEx(B.X1-1, B.Y1-1, 0, StatChars, False, False, 0, 1, Col[i], 5, True, tr_AllChars));
         Result := StrToIntDef(GetNumbers(S), 1);
         Case I of
           1: Result := Result * 1000;
           2: Result := Result * 1000000;
         end;
         Exit;
       end;
    end;
    Last edited by NCDS; 06-23-2010 at 09:19 PM.

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    It should still have three colors, as there are three different colors for gold pieces, aren't there?

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    It should still have three colors, as there are three different colors for gold pieces, aren't there?
    There is a different function for finding Coins.

    You were right, some of them do use the other color. I changed it accordingly.
    Last edited by NCDS; 06-23-2010 at 09:12 PM.

  4. #4
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    There is a different function for finding Coins.
    No, there are yellow, white, green.
    There used to be something meaningful here.

  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Added back the other colors. I guess the one yellow just needed to be updated.

    Seems like these colors should be constants..

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

    Default

    Those 3 colors are there to determine the correct modifier. 1st color is standard yellow, 2nd is color for k, 3rd is for m as they all have different colors once you are at those amounts...

    And I actually have a better version for Simba, as sometimes when you GetAmount in the inventory it'll read the item text next to it.
    (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.

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    Those 3 colors are there to determine the correct modifier. 1st color is standard yellow, 2nd is color for k, 3rd is for m as they all have different colors once you are at those amounts...

    And I actually have a better version for Simba, as sometimes when you GetAmount in the inventory it'll read the item text next to it.
    Ah, well I tested every color except the green and they all work now so I guess I'll just let you do your Dev thing.

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

    Default

    Quote Originally Posted by NCDS View Post
    Ah, well I tested every color except the green and they all work now so I guess I'll just let you do your Dev thing.
    I was thinking of just adding defines for it in SRL so it uses the better method for Simba. There are like 3 other functions I should do this too.

    Where does it use the other color? I haven't had problems with it using it for banking or inventory.
    (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.

  9. #9
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Worked fine.

    SCAR Code:
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    12000000
    Successfully executed.
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    500000
    Successfully executed.
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    5
    Successfully executed.
    There used to be something meaningful here.

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

    Default

    Quote Originally Posted by Frement View Post
    Worked fine.

    SCAR Code:
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    12000000
    Successfully executed.
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    500000
    Successfully executed.
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    5
    Successfully executed.
    In your inventory put something with an amount of 4 letters then right next to it one with 5 letters.

    like

    3423 63345
    (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.

  11. #11
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Worked still fine.

    SCAR Code:
    Compiled succesfully in 546 ms.
    SRL Compiled in 16 msec
    9005
    Successfully executed.
    Compiled succesfully in 546 ms.
    SRL Compiled in 0 msec
    67852
    Successfully executed.

    EDIT: My yellow is: 65535
    There used to be something meaningful here.

  12. #12
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    ^ wat.

    I thought 65535 was black?

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

    Default

    Quote Originally Posted by i luffs yeww View Post
    ^ wat.

    I thought 65535 was black?
    65536 is black.
    (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.

  14. #14
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    ^ wat.

    I thought 65535 was black?
    SCAR Code:
    program new;
    var
      R, G, B:Integer;
    begin
      ColorToRGB(65535, R, G, B);
      Writeln(R);
      Writeln(G);
      Writeln(B);
    end.
    Code:
    Compiled succesfully in 16 ms.
    255
    255
    0
    Successfully executed.
    That ends up being FFFF00, and http://www.colorcombos.com/FFFF00-hex-color

  15. #15
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am deeply confused by this thread.

  16. #16
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    I am deeply confused by this thread.
    The yellow text color needed to be updated, so I did. Narcle apparently has a better way of doing it in SRL5 though. Not sure what that leaves us with now though..

  17. #17
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just the yellow?

    Edit: It appears yellow is fine?
    Last edited by Wanted; 06-24-2010 at 03:25 AM.

  18. #18
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Just the yellow?

    Edit: It appears yellow is fine?
    Yeah, worked for me too.
    There used to be something meaningful here.

  19. #19
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    Just the yellow?

    Edit: It appears yellow is fine?
    Quote Originally Posted by Frement View Post
    Yeah, worked for me too.
    There's 2 different shades of yellow. Try it on multiple different items.

    Equipped arrows wouldn't work before I fixed I know that, but Nature runes would. They were 2 different shades though.

  20. #20
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    65536 is black.
    Wow. That is very misleading. Thanks.

    (Thanks for the explanation to you, too, Myles.

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

    Default

    Quote Originally Posted by NCDS View Post
    There's 2 different shades of yellow. Try it on multiple different items.

    Equipped arrows wouldn't work before I fixed I know that, but Nature runes would. They were 2 different shades though.
    Its probably just the equipped arrow spot then that has a different shade now. Is there any other places you know of?

    (Good to know that, I'll add the color for arrows in)

    Edit:
    yeah 65278 is the equipped arrow amount color, not surprised as its a different interface from the bank/inv
    Last edited by Narcle; 06-24-2010 at 03:48 PM.
    (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.

  22. #22
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    Its probably just the equipped arrow spot then that has a different shade now. Is there any other places you know of?

    (Good to know that, I'll add the color for arrows in)

    Edit:
    yeah 65278 is the equipped arrow amount color, not surprised as its a different interface from the bank/inv
    So with the color I added it should detect all now then, correct?

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
  •