Results 1 to 4 of 4

Thread: How to...?

  1. #1
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to...?

    So when I do FindDTM or something similar the script will search from top left to bottom right. How can I reverse it so that it searches from bottom right to top left?

  2. #2
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    You can't without rewriting the FindDTM code, but you can do something like this:
    Simba Code:
    Function FindMyDTMBottomRight : TPoint;
    Var
      MyDTM : integer;
      Points : array of TPoint;
    begin
      MyDTM := DTMFromString('ehnfsdn');    //Defining your DTM;
      FindDTMs(MyDTM, Points, MSX1, MSY1, MSX2, MSY2); //Searches for it and stores every time it find it in "Points"
      FreeDTM(MyDTM);   //Free the DTM
      if(GetArrayLength(Points) = 0)then   //if it didn't find it then the array length will be 0 so it exits
        exit;
      SortTPAFrom(Points, Point(MSX2, MSY2));  //it sorts the points from the bottom right of the screen
      Result := Points[0];   //so the bottom right point will now be the first one
    end;

    If you don't understand anything feel free to ask...

  3. #3
    Join Date
    Mar 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Yeah it's best to use main screen X and Y so it starts from middle.

  4. #4
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    You'd want to use something like this in your script. Usage is exactly the same as regular FindDTM. The "bu" at the end stands for "bottom up".

    Simba Code:
    function FindDTMbu(DTM: Integer; var x, y: Integer; const x1, y1, x2, y2: Integer): Boolean;
    var
      tempTPA: TPointArray;
    begin
      Result := FindDTMs(DTM, tempTPA, x1, y1, x2, y2);
      if(not(Result)) then
        Exit;

      InvertTPA(tempTPA);
      x := tempTPA[0].x;
      y := tempTPA[0].y;
    end;

    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

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
  •