SRL Archive - OSR Help

If..Then...Begin...End Else loop help


Total

2012-03-28 14:31:34

Here is a segment of code from a procedure that im not sure is working correctly.

 if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(8);
MarkTime(T1);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else
begin
if not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23)
Writeln('Failsafe radial walking 0');
MarkTime(T1);
FFlag(8);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else
end;
if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
begin
Writeln('Couldnt find path to altar');
Players[CurrentPlayer].Loc := 'Logout';
end;

What its supposed to do if find the dtm, and if it doesnt, then it failsafes to radialwalk, and then if it fails to radialwalk then it logs out. Is the code correct for this or am I doing it wrong?

Raskolnikov

2012-03-28 14:51:39

if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(8);
MarkTime(T1);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else if RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23) then
begin
Writeln('Failsafe radial walking 0');
MarkTime(T1);
FFlag(8);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else
if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
begin
Writeln('Couldnt find path to altar');
Players[CurrentPlayer].Loc := 'Logout';
end;

Littellj

2012-03-28 23:32:41

From: Cut em2 it
if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(8);
MarkTime(T1);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else if RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23) then
begin
Writeln('Failsafe radial walking 0');
MarkTime(T1);
FFlag(8);
repeat
Wait(50 + Random(25));
until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
end else
if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
begin
Writeln('Couldnt find path to altar');
Players[CurrentPlayer].Loc := 'Logout';
end;



I feel like i just learned a lot from reading that code. lol thanks.