SRL Archive - OSR Help

How to...?


peetu

2012-05-04 12:58:31

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?

putonajonny

2012-05-04 20:16:22

You can't without rewriting the FindDTM code, but you can do something like this:
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…

Spandzbab

2012-05-05 00:52:00

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

Daniel

2012-05-07 03:52:45

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".


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;

:)