SRL Archive - OSR Help

How to repeat FindDTM


rsbots2013

2013-05-12 15:33:56

How do I repeat "FindDTMRotated" so it keeps looking for the DTM until it finds it.
       begin
wait(4000);
if FindDTMRotated(FromBank3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
//P07_ChooseOptionMulti(['ine']);
End;
end;

x[Warrior]x3500

2013-05-12 15:36:46

while(not(findDTMRotated(...)))do
begin
wait(200+random(50));
//put failsafe here to get out of infinite loop
end;

?

rsbots2013

2013-05-12 16:18:58

is there a way of doing this using repeat and until?

Haxz

2013-05-12 16:22:03

var
t: integer;

marktime(t);
repeat
if FindDTMRotated(FromBank3, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
Break; //break out of the loop if found dtm
end;
until timefrommark(t) > 60000; //out of the loop after 60 seconds of not finding

rsbots2013

2013-05-12 16:29:00

it's telling me to "Duplicate identifier 'marktime'"

Haxz

2013-05-12 16:35:43

From: rsbots2013
it's telling me to "Duplicate identifier 'marktime'"


Try changing t to something else. Probably had t declared as something else already.

rsbots2013

2013-05-12 16:52:25

From: Haxz
Try changing t to something else. Probably had t declared as something else already.


I have not used t anywhere else and I'm still getting the same problem

var
t : integer;
marktime(t);
repeat
if FindDTMRotated(FromBank1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
End;
until timefrommark(t) > 10000

samerdl

2013-05-12 17:13:31

From: rsbots2013
I have not used t anywhere else and I'm still getting the same problem


procedure tese1;
var
t : integer;
begin
marktime(t);
repeat
if FindDTMRotated(FromBank1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
exit;
End;
until timefrommark(t) > 10000
end;

changed some fields in quote also you can tru changing t to any other alphabetical letter(s)

your missing begin under the var, also i think exit would work too, it would exit the count and you can direct it to the bext step

rsbots2013

2013-05-12 17:18:21

I think I got it to work. What would I need to do if I wanted to continue to a new DTM. What I'm doing is making a DTM path. So example of my script. And it seems like "marktimer: (t);" was wrong its suppose to be "marktimer: (t);"

var
t : integer;
marktimer:(t);
begin
repeat
if FindDTMRotated(FromBank1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
End;
until timefrommark(t) > 10000

begin
repeat
if FindDTMRotated(FromBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
End;
until timefrommark(t) > 10000
end;

x[Warrior]x3500

2013-05-12 17:40:52

^

procedure foo();
var
t,x,y: integer;
aFound:extended;
begin
marktime(t);

repeat
if FindDTMRotated(FromBank1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
end;
until (timefrommark(t) > 10000);

repeat
if FindDTMRotated(FromBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
end;
until (timefrommark(t) > 10000);

end;

rsbots2013

2013-05-12 18:03:54

From: x[Warrior]x3500
^

procedure foo();
var
t,x,y: integer;
aFound:extended;
begin
marktime(t);

repeat
if FindDTMRotated(FromBank1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
end;
until (timefrommark(t) > 10000);

repeat
if FindDTMRotated(FromBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) or
FindDTMRotated(FromBankB2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then
begin
Mouse(X, Y, 0, 0, true);
break;
end;
until (timefrommark(t) > 10000);

end;


Thank you! :)

x[Warrior]x3500

2013-05-12 18:06:32

From: rsbots2013
Thank you! :)


u might want to put a second marktime(t); after your first repeat-until loop. this will reset timefrommark(t) to 0.