Results 1 to 17 of 17

Thread: DTM Can't Be Found On Minimap

  1. #1
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default DTM Can't Be Found On Minimap

    Hey,

    for a failsafe I need my script to check if the character is on the right floor of a building. I got the idea to simply check if there is a block of black on the minimap which is a tell-tail sign for that.

    RightFloor:= DTMFromString('mWAAAAHicY2FgYJjGxMCwBIjnA/FEIJYAiikDsQYQywMxMyMLCkYHjGgYBADlsAMd');

    if FindDTM(RightFloor, x, y, 520, 0, 740, 169) then

    begin
    Writeln('Walked the stairs successfully, I am on floor #2 now');
    end else

    begin
    Writeln('Something went wrong, the stairs were not clicked correctly. Trying again...');
    end;
    Well, it simply doesn't work. I had problems with DTMs not being detected due to unknown reasons and it somehow always worked out when playing with the coordinates in which the FindDTM procedure searches, this time I can't make it work. The cordinates you see in this example are the minimap, and the DTM is composed only of black points, so I don't see the problem.

    Any ideas, fellow scripters?

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

    Default

    Quote Originally Posted by SomeGuyFromHere View Post
    Hey,

    for a failsafe I need my script to check if the character is on the right floor of a building. I got the idea to simply check if there is a block of black on the minimap which is a tell-tail sign for that.



    Well, it simply doesn't work. I had problems with DTMs not being detected due to unknown reasons and it somehow always worked out when playing with the coordinates in which the FindDTM procedure searches, this time I can't make it work. The cordinates you see in this example are the minimap, and the DTM is composed only of black points, so I don't see the problem.

    Any ideas, fellow scripters?
    Why not just search a specific section of the minimap that always contains black for the color?

    Simba Code:
    FindColorsTolerance(x, y, ColorForBlackHere, MMX1, MMY1, MMX2, MMY2, 100)
    You can replace {MMX1, MMY1, MMX2, MMY2} with the coordinates.

  3. #3
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Tried it, it doesn't work either! Don't really know what's up here. Here is a screenshot:



    and the part of the procedure responsible for the whole thing looks like this:

    Code:
    if FindColor(x, y, 394243, 672, 36, 672, 36) then
          begin
          Writeln('Walked the stairs successfully, I am on floor #2 now');
          StairTries:= 10;
          StairSuccess1:= True;
          end else
            begin
            Writeln('Something went wrong, the stairs were not clicked correctly. Trying again...');
            StairTries:= (StairTries + 1);
            SPS_WalkPath(GirlToSummoningGuy);
            StairSuccess1:= False;
            end;

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

    Default

    Isnt the color for black 0?

  5. #5
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    I don't think the black color on the minimap is 0

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

    Default

    Are you using ACA?

  7. #7
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by SRLKing View Post
    Are you using ACA?
    Correct, that is how I got the color.

    EDIT: Seems the color is changing massively all the time, from 394243 to 198407 to 1284, all on the "same" black area. Hell, I'm gonna need a massive tolance to account for that, and then the whole failsafe might get really unreliable...
    Last edited by SomeGuyFromHere; 02-18-2013 at 05:40 PM.

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

    Default

    Quote Originally Posted by SomeGuyFromHere View Post
    Correct, that is how I got the color.

    EDIT: Seems the color is changing massively all the time, from 394243 to 198407 to 1284, all on the "same" black area. Hell, I'm gonna need a massive tolance to account for that, and then the whole failsafe might get really unreliable...
    Hmmm it shouldnt be changing that much, try looking for something else unique?

  9. #9
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Try counting colors like:

    Simba Code:
    function IsInSpot(): boolean;
    Var
      BlackCount,WhiteCount,RedCount:Integer;
    begin
      BlackCount := CountColorTolerance(196609, x1, y1, x2, y2, 3);
      WhiteCount := CountColorTolerance(14472413, x1, y1, x2, y2, 5);
      RedCount := CountColorTolerance(4215405, x1, y1, x2, y2, 8);
      Result := false;
      if (BlackCount >= 10) and (WhiteCount >= 5) and (RedCount >= 10)then
      begin
        Result := true;
      end;
    end;

    Count the colors in the area, and if it's not in the spot then do something

  10. #10
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by rjj95 View Post
    Count the colors in the area, and if it's not in the spot then do something
    The problem I see with that is that the "black" color varies greatly each time I start the game. What would be interesting would be to pic the color from one spot and compare it to a few other spots; if the color is the same on all spots then it's the right place.
    Hmmm it shouldnt be changing that much, try looking for something else unique?
    Difficult, even the shapes of another unique object on the minimap differs depending on the angle because of pixelation. The most unique feature changing on the second floor is part of the minimap becoming black, period.

  11. #11
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by SomeGuyFromHere View Post
    The problem I see with that is that the "black" color varies greatly each time I start the game. What would be interesting would be to pic the color from one spot and compare it to a few other spots; if the color is the same on all spots then it's the right place.

    Difficult, even the shapes of another unique object on the minimap differs depending on the angle because of pixelation. The most unique feature changing on the second floor is part of the minimap becoming black, period.
    Is it waaaay different like 196609 sometimes and like 0 others?

  12. #12
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    As I wrote above, 3 tries resulted in the colors 394243, 198407 and 1284.

  13. #13
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Found another object to use as DTM, the bridge connecting the two homes. The edges never change, not even when somebody walks the bridge. Still this black-is-not-black-thing annoys the hell out of me.

  14. #14
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    There is a function in the SRL include that calculates the percentage of black colour on the minimap.
    I use that in my script to check that I'm on the right floor:

    Function PercentBlackMM: Integer;

    It's very accurate. Use Writeln(IntToStr(PercentBlackMM... to debug the %Black on all the levels and then go from there.

  15. #15
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    It's on my list of things I'm going to try sometimes now. Thanks Runehack123

  16. #16
    Join Date
    Dec 2012
    Posts
    73
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    THX again, this is most helpful when checking if the second stair walking procedure got me to the ground floor again.

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

    Default

    Quote Originally Posted by SomeGuyFromHere View Post
    THX again, this is most helpful when checking if the second stair walking procedure got me to the ground floor again.
    DTM's aren't 100% accurate on MM
    And better to use FindDTMRotated instead of FindDTM
    If using DTM's on minimap, try making multiple dtm's as a failsafe.

    Creds to DannyRS for this wonderful sig!

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
  •