SRL Archive - OSR Help

breaking loops?


rya

2010-02-28 11:14:14

so ive beening trying to make a yew cutter but got annoyed of making the finding function so im trying make the loop
So how would i break out of the If Then but not the Repeat Until Loop?

Function CutTillFull:Boolean;

Begin
If Not LoggedIn Then Exit;

Repeat

If InvFull Then
Begin
Reult := True
Exit;
End;

If Not CuttingYews Then
Begin
If TpaFind(1,'ew') Then
Begin
If Not IsUpText('ew') Then
//Here i want to break out of the If Then but not the Repeat Until loop
GetMousePos(x,y);
If Random(10)=5 Then
Begin
Mouse(x,y,0,0,False);
ChooseOption('ew');
End Else
Mouse(x,y,0,0,True);
End;
End;



Until(False);
End;

Thanks
~Rya

Edit: If some one could add me on msn tp help me that would be great

Naum

2010-02-28 11:34:29

All you need to use is 'Break;', which you kinda touched on.

If Not IsUpText('ew') Then {}Break;{}

Should do the trick :)

Function

2010-02-28 11:36:27

If I understand what your asking, you cannot break out of an if then. Because if the condition is true it'll continue and if its false it will not. So maybe I just don't understand your question. Feel free to hit me up on MSN if you would like [email]TheAlphaEchoTango@live.com[/email]

rya

2010-02-28 11:36:41

From: Naum
All you need to use is 'Break;', which you kinda touched on.

If Not IsUpText('ew') Then {}Break;{}

Should do the trick :)


So that won't stop the repeat loop

Naum

2010-02-28 11:37:55

Oh lol, I miss-read.

Edit, just do the if statement before the other so it doesn't carry on. Like so:

      If {Not} IsUpText('ew') Then //change it appropriately here 
If TpaFind(1,'ew') Then
Begin
GetMousePos(x,y);
If Random(10)=5 Then
Begin
Mouse(x,y,0,0,False);
ChooseOption('ew');
End Else
Mouse(x,y,0,0,True);
End;

rya

2010-02-28 11:43:42

ok thanks for the help :)