Results 1 to 12 of 12

Thread: I Need an CountBankStockDTM;

  1. #1
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default I Need an CountBankStockDTM;

    that will return how many you've got of the DTM (Yellow Text)
    so not like countitemsdtm but an stock.
    Thank You!
    ~Hermen

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Maybe use GetTextAt by using StatChars (I think it is)

  3. #3
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    tried the ones by masquerader in amount.scar yet?

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That is an how many of it exist not the yellow number count if im right.

    Edit:
    what is the fastest way?

    Result:= GetAmount(ItemCoordsDtm('Bank',DTM))> 13;
    I know why that is not working but maybe you got an idea?
    ~Hermen

  5. #5
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Here

    SCAR Code:
    {*******************************************************************************
    function GetAmount(itemx, itemy: Integer): Integer;
    By: masquerader || Improved by Freddy1990 ||Updated June 4 2007 by Boreas || Fixed by Mr. Freeweed
    Description: Returns the ammount of an item at a certain position.
    *******************************************************************************}


    function GetAmount(itemx, itemy: Integer): Integer;
    //uses font cropped to work with "Opponent's Offer"
    //you can get the coords from using IsTextInAreaEx w/ StatChars, but
    //you probably shouldnt use this function directly (other functions use it)
    //'K' and 'M' work (for approx values)
    //non-stackable =1
    //blank = 0
    var
      amountstr: string;
      tempx, tempy, color: Integer;
    begin
      if findcolor(tempx, tempy, 65535, itemx, itemy, itemx + 10, itemy + 10) then
        color := 65535;
      if color = 0 then
        if findcolor(tempx, tempy, 16777215, itemx, itemy, itemx + 10, itemy + 10) then
          color := 16777215;
      if color = 0 then
        if findcolor(tempx, tempy, 8453888, itemx, itemy, itemx + 10, itemy + 10) then
          color := 8453888;
      amountstr := TrimOthers(GetTextAtEx(itemx, itemy + 4, 0, tradeChars, False, False, 0, 2, color, 10, True, tr_AlphaNumericChars));
      if (Length(amountstr) > 0) then
      begin
        if (Pos('K', amountstr) > 0) then
        begin
          Delete(amountstr, Length(amountstr), Length(amountstr));
          Result := StrToInt(amountstr) * 1000;
        end else
          if (Pos('M', amountstr) > 0) then
          begin
            Delete(amountstr, Length(amountstr), Length(amountstr));
            Result := StrToInt(amountstr) * 1000000;
          end else
            Result := StrToInt(amountstr);
      end else
        if (FindColor(tempx, tempy, 65536, itemx, itemy, itemx + 30, itemy + 30)) then
          Result := 1;
    end;

  6. #6
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Naum your posts are getter wurser and wurser read the first post and i already fixed it.
    ~Hermen

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Hermpie View Post
    Naum your posts are getter wurser and wurser read the first post and i already fixed it.
    How they are getting more worse Heres a nice link for you
    You could have edited your First post to say you had fixed it......

    Thanks.

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    How they are getting more worse Heres a nice link for you
    You could have edited your First post to say you had fixed it......

    Thanks.
    If you have nothing to say back, you give me an grammar dictionary?
    Go black mail people for rep ++ pl0x dude.
    ~Hermen

  9. #9
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    Here

    SCAR Code:
    {*******************************************************************************
    function GetAmount(itemx, itemy: Integer): Integer;
    By: masquerader || Improved by Freddy1990 ||Updated June 4 2007 by Boreas || Fixed by Mr. Freeweed
    Description: Returns the ammount of an item at a certain position.
    *******************************************************************************}


    function GetAmount(itemx, itemy: Integer): Integer;
    //uses font cropped to work with "Opponent's Offer"
    //you can get the coords from using IsTextInAreaEx w/ StatChars, but
    //you probably shouldnt use this function directly (other functions use it)
    //'K' and 'M' work (for approx values)
    //non-stackable =1
    //blank = 0
    var
      amountstr: string;
      tempx, tempy, color: Integer;
    begin
      if findcolor(tempx, tempy, 65535, itemx, itemy, itemx + 10, itemy + 10) then
        color := 65535;
      if color = 0 then
        if findcolor(tempx, tempy, 16777215, itemx, itemy, itemx + 10, itemy + 10) then
          color := 16777215;
      if color = 0 then
        if findcolor(tempx, tempy, 8453888, itemx, itemy, itemx + 10, itemy + 10) then
          color := 8453888;
      amountstr := TrimOthers(GetTextAtEx(itemx, itemy + 4, 0, tradeChars, False, False, 0, 2, color, 10, True, tr_AlphaNumericChars));
      if (Length(amountstr) > 0) then
      begin
        if (Pos('K', amountstr) > 0) then
        begin
          Delete(amountstr, Length(amountstr), Length(amountstr));
          Result := StrToInt(amountstr) * 1000;
        end else
          if (Pos('M', amountstr) > 0) then
          begin
            Delete(amountstr, Length(amountstr), Length(amountstr));
            Result := StrToInt(amountstr) * 1000000;
          end else
            Result := StrToInt(amountstr);
      end else
        if (FindColor(tempx, tempy, 65536, itemx, itemy, itemx + 30, itemy + 30)) then
          Result := 1;
    end;
    Quote Originally Posted by Hermpie View Post
    Naum your posts are getter wurser and wurser read the first post and i already fixed it.


    Nothing to say back.. eh?

  10. #10
    Join Date
    Dec 2007
    Location
    Wizzup?'s boat
    Posts
    1,013
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is how i managed it once in one of my scripts.... I dont know whether the standards and such are correct... But it works !

    SCAR Code:
    if FindDTM(DTM,x,y,MSX1,MSY1,MSX2,MSY2) then
        begin
          i:=15
          repeat
            Amount:=GetTextAtEx(x-i, y-i, 20, statchars, false, false, 0, 1, 65535, 5, false, tr_AlphaNumericChars);
            Amount:=trim(TrimOthers(Amount));
            i:=i+1;
          until not(Amount='') or (i=21);
          if not (Amount='') then
          begin
            Writeln(Amount+' Instances');
          end;
       end;


    EDIT: Remember to Declare vars: x,y,i,Amount:integer;
    Project: Welcome To Rainbow

  11. #11
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by benjaa View Post
    This is how i managed it once in one of my scripts.... I dont know whether the standards and such are correct... But it works !

    SCAR Code:
    if FindDTM(DTM,x,y,MSX1,MSY1,MSX2,MSY2) then
        begin
          i:=15
          repeat
            Amount:=GetTextAtEx(x-i, y-i, 20, statchars, false, false, 0, 1, 65535, 5, false, tr_AlphaNumericChars);
            Amount:=trim(TrimOthers(Amount));
            i:=i+1;
          until not(Amount='') or (i=21);
          if not (Amount='') then
          begin
            Writeln(Amount+' Instances');
          end;
       end;


    EDIT: Remember to Declare vars: x,y,i,Amount:integer;

    Thats pretty good, Could I use it?

  12. #12
    Join Date
    Dec 2007
    Location
    Wizzup?'s boat
    Posts
    1,013
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    sure buddy

    please credit
    Project: Welcome To Rainbow

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
  •