Log in

View Full Version : How can I do this?



peetu
05-04-2012, 04:57 PM
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?

Rich
05-04-2012, 05:00 PM
Just reverse the search coordinates (I think), so like thisFindDTM(DTM, X, Y, MSX2, MSY2, MSX1, MSY1)

Narcle
05-04-2012, 05:26 PM
Just reverse the search coordinates (I think), so like thisFindDTM(DTM, X, Y, MSX2, MSY2, MSX1, MSY1)

Last I knew that gave an error. Search pattern is internal and can't be changed unless you use a different function or there's a way to change it via another method globally.

Rich
05-04-2012, 05:49 PM
Ah fair enough. In that case I guess you could do multiple searches working upwards.
Eg.
FindDTM(DTM, X, Y MSX2-100, MSY2-100, MSX2, MSY2)And increase that 100 in intervals until you find what you want. Could be done easier in an for to do loop or a while do.

litoris
05-04-2012, 07:15 PM
Or, is there a way to skip the found DTMs until the last one is reached?

Rich
05-04-2012, 07:45 PM
function FindLowDTM(DTM : LongInt, var X : LongInt, var Y : LongInt, XS, YS, XE, YE : LongInt) : Boolean;
var
sX, sY : Integer;

begin
sX:= XS;
sY:= YS;
repeat
if FindDTM(DTM, X, Y, sX, sY, XE, YE) then
begin
Result:= True;
sX:= X;
sY:= Y;
end;
until(not(FindDTM(DTM, X, Y, sX, sY, XE, YE)))
end; ?

Something I just whipped up quickly. Haven't tested it but hopefully it'll work if I've thought it through properly...

bg5
05-04-2012, 08:19 PM
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?

It's propably impossible ,but why you want to do this? You can simple use
FindDTMs(); to get coords of all DTMs.

Rich
05-04-2012, 08:25 PM
Wow...Didn't even know about FindDTMs.