Results 1 to 9 of 9

Thread: DTM (smaller dtm's)

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

    Default DTM (smaller dtm's)

    Hello, I have a question regarding DTM's and differentiating them when given a small amount of pixels to choose from / use.

    Since arrows are generally differentiated by the color in their arrow tips, would a DTM be useful in this case? Especially since the arrow heads are not touching all the time and have such a small amount of pixels within their heads.

    What would be a more efficient alternate that would help find specific arrows versus their counterpart types (i.e. iron vs. steel) and being able to count how many arrows (1, 2, 3, 4, or 5+) are in the stack of them self?

    E: Also, when poison arrows come into play, would you change your method?

  2. #2
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    You can still use a DTM. Just grab the main color of the arrow head and then a few of the black outline points. If you don't need to differentiate between iron, steel, etc. check out the FilterTPASegment function in my signature.

    As for counting, there's a function for that. Something like CountItems. I'm not entirely sure though, can't check right now.

    Edit: I'm assuming that the shape of the arrowhead(s) doesn't change (or at least one of them doesn't) when you go from 1 to 2, 3, etc. I haven't used arrows in a while
    Last edited by Runaway; 06-10-2012 at 04:16 AM.

  3. #3
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    1,199
    Mentioned
    0 Post(s)
    Quoted
    26 Post(s)

    Default

    Umm, I think I would make a DTM for an arrow (a single arrow only!) by choosing the main color to be its head and then set the rest of the points as the black outline.

    I just tested this on rune arrows with the main point in the center of the head and selecting portions of the black outline and it found them from 1-4, and then 36. I have Zammy arrows in my in and the bank and it didnt find either of those. As a note, single arrows seem to be shaped slightly different when they are in the bank than when they are in the inventory.

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

    Default

    My problem resides with picking a reliable DTM, if I am to use that to count the items in the found DTM slot, for example:



    The short DTM I made, when searching across all of the arrows comes up with the 3rd stack of arrows (the 3rd arrow stack, with 3 arrows in it). I am trying to stick to using a DTM, however I'm wary that my DTM, (i.e. the arrow above) will change (it will in color I'm sure, and I've accounted for that with tolerance) however the shape, itself is my concern.

    (I suppose I am looking for a different way, because there's no generic DTM for the arrows. - I'm reading over your link suggestion as of right now too, Runaway)

    Perhaps my answer lies within picking a unique DTM for each arrowhead on top of each arrow, and lowering my tolerance very very low?

  5. #5
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Get as many DTMs as needed and search for them all, then use the function in inventory.simba(iirc) to check the amount of arrows.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

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

    Default

    Quote Originally Posted by litoris View Post
    Get as many DTMs as needed and search for them all, then use the function in inventory.simba(iirc) to check the amount of arrows.
    I am looking for a best fitting DTM. If one DTM won't work for all of them, or if one DTM won't work for each of them, then I'll probably not use a DTM for this arrow finding (unless it's an equally good/efficient method as Finding multiple DTMs). Ideally I'm trying to create one DTM value/string and store it as an integer. If I can do a begin .. end for a list of DTM's and store that as a value, I suppose this could be a last attempt.

  7. #7
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Just a suggestion, have the user select a string of which arrow-type they are using at the beginning of the script and then have the correlate with an appropriate colour you have determined to be whichever type of arrow they are using. If the script then finds that colour within the inventory you can implement something along these lines

    Simba Code:
    function HowManyArrows: integer;
    var
      x,y,ArrowHead,tolerance: integer;
    begin
      if FindColorTolerance(x,y,ArrowHead,MIX1,MIY1,MIX2,MIY2,tolerance) then
      begin
        Result := GetAmountBox(InvBox(CoordsToItem(x,y)));
        Exit;
      end else
      Result := 0;
      Exit;
      // We have no arrows of that type in inventory
    end;

  8. #8
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    i would do a dtm with the top color, then part of the brown shaft but it has to be really close, and id suggest it should be almost straight up and down. then use
    Simba Code:
    function FindDTM(item : integer) : boolean;
    var
      itemBox : TBox;
      Text,Text1,Text2,Text3,DTM : integer;
    begin
      itemBox := InvBox(item);
      DTM := DTMFromString('mrAAAAHic42BgYJjKxMAwAYgnA/EMIJ4NxBOBeD4QLwViFkYIZgBiRiibA4jZoPT6mp0ME9JmMBQElDO0xfeC+etmb2KYlj2fYcXUNQz8QK34MCMBDAMAxeMTBw==');
      Result := FindDTM(DTM, x, y, ItemBox.x1, itemBox.y1, ItemBox.x2, ItemBox.y2);
      FreeDTM(DTM);
    end;

    Simba Code:
    for i := 1 to 28 do
          begin
            if FindDTM(i) then
            begin
              Text := GetTextAtExWrap(560,210,596,222,0,0,0,65535,5,'StatChars');
      If (Text<>'') Then
        begin
        Text1 := Replace(Text,' ','');
        Text2 := Replace(Text1,'?','7');
        Text3 := Replace(Text2,'K','000');
        end else
        begin
        Text3 := '0';
        end;
              break;
            end;
          end;

    the bottom function youd have to find a way to change where that counts, unless the arrows will alwasy be in a certain slot, then you could ignore finding where they are, and just count them

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

    Default

    Quote Originally Posted by bolshak25 View Post
    i would do a dtm with the top color, then part of the brown shaft but it has to be really close, and id suggest it should be almost straight up and down.

    Ahh thanks, I kept trying to grab as many points as I could, which just made things messy for me; but I've made 2 simple DTM's that locate the arrows in all sizes (stacked from 1 - 5). And I'll keep in mind of the arrow counting, but for now I'll stick to making more accurate arrow heads, for just a little project I've got going

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
  •