Results 1 to 9 of 9

Thread: Count DTM Matches?

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Count DTM Matches?

    Is there a function for this? I've looked through the include and can't find anything. I need it to figure out how many fish were cooked, and how many were burned.

    Thanks
    ~Footy
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Use FindDTMs. That should store all the possible fishies as a TPA. Use Length(TPA) + 1 to determine the amount of fishies.


  3. #3
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great! Thanks(again)!


    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    CountItemIn(........);

    It's something like that. It'll count the amount of DTM's. Or use ItemAmount(...); It'll again, count how many of a dtm is in your inventory.
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Another problem... I've made my DTM with as many points as possible so it only finds one match per fishie, but I'm still getting 244 matches with 27 fish in my inv... This is what the DTM editor looks like.


    And this is my code:
    Simba Code:
    procedure test;
    var
      thisTPA:TPointArray;
      DTM, P:Integer;
    begin
      DTM := DTMFromString('mfgEAAHicE2JgYMhhYmDIh+JEIE4A4nIgLgHidCjOgorFAXEplJ8CxblAXATENowMDM5AbALEbkBsC8QWQGwHxO5AbIYkDlJnCMUgOUuoHEhvfHAQ0FVMFGNWBuoARiphTAAAH5sNWg==');
      FindDTMs(DTM, thisTPA, MIX1, MIY1, MIX2, MIY2);
      P := Length(thisTPA) + 1;
      writeln(IntToStr(P));
    end;

    Yet the output is 244... Is there a better way to do this? I can't make any more points on the outline anymore, since I'm clicking on other points.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  6. #6
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    Another problem... I've made my DTM with as many points as possible so it only finds one match per fishie, but I'm still getting 244 matches with 27 fish in my inv... This is what the DTM editor looks like.


    And this is my code:
    Simba Code:
    procedure test;
    var
      thisTPA:TPointArray;
      DTM, P:Integer;
    begin
      DTM := DTMFromString('mfgEAAHicE2JgYMhhYmDIh+JEIE4A4nIgLgHidCjOgorFAXEplJ8CxblAXATENowMDM5AbALEbkBsC8QWQGwHxO5AbIYkDlJnCMUgOUuoHEhvfHAQ0FVMFGNWBuoARiphTAAAH5sNWg==');
      FindDTMs(DTM, thisTPA, MIX1, MIY1, MIX2, MIY2);
      P := Length(thisTPA) + 1;
      writeln(IntToStr(P));
    end;

    Yet the output is 244... Is there a better way to do this? I can't make any more points on the outline anymore, since I'm clicking on other points.
    Do it the way Brandon suggested countitems Edit: like this to count ores in LRC script

    Simba Code:
    OreCount := OreCount + CountItems('DTM',GoldDTM,[])+CountItems('DTM',CoalDTM,[]);

  7. #7
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    CountItemIn(........);

    It's something like that. It'll count the amount of DTM's. Or use ItemAmount(...); It'll again, count how many of a dtm is in your inventory.
    Thanks Ashaman and Brandon, this one worked perfectly. Again, I can't rep either of you... Maybe my rep is broken. Thanks anyways!
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  8. #8
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    You could also use the bounds of an inventory slot and search in there. If it finds one or more matches you simply increase the amount of matches by one instead of the amount of matches.

    Simba Code:
    for i:=0 to 27 do
      if FindDTM(blabla, InvBox(i).X1, etc.) then
      inc(matches)

    I'm using that in my cooking guild script for the competition but I actually ran out of variables or something so I stored them as a TBox each time. Otherwise you are using 28*4 coords :P

    Script source code available here: Github

  9. #9
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by J J View Post
    You could also use the bounds of an inventory slot and search in there. If it finds one or more matches you simply increase the amount of matches by one instead of the amount of matches.

    Simba Code:
    for i:=0 to 27 do
      if FindDTM(blabla, InvBox(i).X1, etc.) then
      inc(matches)

    I'm using that in my cooking guild script for the competition but I actually ran out of variables or something so I stored them as a TBox each time. Otherwise you are using 28*4 coords :P
    Yeah that is actually how CountItems works. Mastering the SRL include can often save many lines of code

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
  •