Log in

View Full Version : whats so bad about 'until(false)'



Sockz
04-13-2012, 02:19 AM
Hey guys, just a general question.

Is using until(false) bad scripting practice? Like take a look at my code below. Just wanted multiple peoples opinions.

Is there anyway that my code could create an infinite loop?

THANX

Repeat
FindNormalRandoms;
if FindDTM (burner, x, y, 109, 14, 317, 196) then
begin
mouse(x, y, 2, 2, true);
AntiBan;
MarkTime(t);
Repeat
if TimeFromMark(t) > 5000 then
break;
wait(1)
Until(ExistsItem(2) = false);
end;
if ExistsItem(2) then
begin
i:= i + 1
end else
begin
Break;
end;

if i = 5 then
begin
WriteLn('Unable to light burnner 1, Logging Out');
Logout;
TerminateScript;
end;
Until(false);

Flight
04-13-2012, 02:30 AM
Nothing wrong with using (false) to trigger a constant loop, as long as there's failsafes (which you have) to break the loop no matter what. I cleaned it up a bit for ya so it's easier to understand. :p


Repeat
FindNormalRandoms;

if FindDTM (burner, x, y, 109, 14, 317, 196) then
begin
mouse(x, y, 2, 2, true);
AntiBan;

MarkTime(t);
Repeat
if TimeFromMark(t) > 5000 then
break;
wait(1)
Until(not ExistsItem(2));

end;

if ExistsItem(2) then
Inc(i)
else
Break;

if (i = 5) then
begin
WriteLn('Unable to light burnner 1, Logging Out');
Logout;
TerminateScript;
end;

Until(false);

Caotom
04-13-2012, 02:53 AM
The only time that a loop becomes 'bad' is when there is a circumstance that will cause the loop to never break.
An example of this would be using a loop that waits for a boolean value, maybe the existence of a colour, before breaking the loop, the issues occurs when the scripter has not put in a failsafe if this colour should randomly not appear.

~Caotom

Sockz
04-13-2012, 03:01 AM
Thanks a heap guys, updated my script, gonna release... V1 :D