SRL Archive - OSR Help

Logic seems off


Element17

2012-05-10 15:26:30

This doesn't seem to be right to me….trying to find the best logical way to do this. I know I post asking a lot of questions, sorry.



Function ClickFishing : Boolean;
Var Tries: Integer;
Begin
If(Not(LoggedIn))Then Exit;
Repeat
Inc(Tries)
If(Not(FindNormalRandoms)) Then
Begin
If FishingSpot(x, y) Then
HumanMMouse(x, y, 2, 2);
ClickMouse2(False);
WaitOption('rpoon', 500);
If DidRedClick or DidYellowClick Then
Begin
Writeln('Yay! We are fishing!');
Exit;
End;
Until(IsFishing or (Tries = 5))
If (Tries = 5) Then
Begin
FailSafe('Tired five times, logging out');
Logout;
End;
Wait(500+Random(250));
While IsFishing Do
AntiBan;
FindNormalRandoms;
Writeln('Should be fishing now');
Wait(750+Random(200));
End;

masterBB

2012-05-10 15:33:30

Function ClickFishing : Boolean;
Var Tries: Integer;
Begin
If(Not(LoggedIn))Then
Exit;

Repeat
Inc(Tries);

If(Not(FindNormalRandoms)) Then
Begin //begin with no end
If FishingSpot(x, y) Then //only the next line is if dependent
HumanMMouse(x, y, 2, 2);

ClickMouse2(False);
WaitOption('rpoon', 500);

If DidRedClick or DidYellowClick Then
Begin
Writeln('Yay! We are fishing!');
Exit;
End;

Until(IsFishing or (Tries = 5))

If (Tries = 5) Then
Begin
FailSafe('Tired five times, logging out');
Logout;
End;

Wait(500+Random(250));

While IsFishing Do
AntiBan;

FindNormalRandoms;
Writeln('Should be fishing now');
Wait(750+Random(200));
End;

It contains some logical errors. Can you spot your mistakes with begin and end?

Element17

2012-05-10 15:35:21

Yeah I just noticed the being and end error. I just threw this together and it seemed off to me.



Edit**** Not fixed*Facepalm* Trying pixelshift/animating srl include

NexPB

2012-05-10 15:36:01


procedure ClickFishing;
Var
Tries: Integer;
Begin
If(Not(LoggedIn))Then Exit;
If(FindNormalRandoms) Then exit;

Repeat
Inc(Tries)
If(Not(IsFishing)) Then
Begin
If FishingSpot(x, y) Then
begin
HumanMMouse(x, y, 2, 2);
ClickMouse2(False);
WaitOption('rpoon', 500);
If DidRedClick Then
Begin
Wait(500+Random(250));
Writeln('Yay! We are fishing!');
Exit;
End;
end;
end;
Until(IsFishing or (Tries = 5));

Wait(500+Random(250));
While IsFishing Do
AntiBan;
FindNormalRandoms;
Writeln('Should be fishing now');
Wait(750+Random(200));
End;

Fixed a bit why do you use a function if you don't return anything

masterBB

2012-05-10 15:37:21

From: 14578
Yeah I just noticed the being and end error. I just threw this together and it seemed off to me.


There are quite some small mistakes. Just try to fix as much as them as you can find and post the code again.

Element17

2012-05-10 17:06:36

From: NexPB

procedure ClickFishing;
Var
Tries: Integer;
Begin
If(Not(LoggedIn))Then Exit;
If(FindNormalRandoms) Then exit;

Repeat
Inc(Tries)
If(Not(IsFishing)) Then
Begin
If FishingSpot(x, y) Then
begin
HumanMMouse(x, y, 2, 2);
ClickMouse2(False);
WaitOption('rpoon', 500);
If DidRedClick Then
Begin
Wait(500+Random(250));
Writeln('Yay! We are fishing!');
Exit;
End;
end;
end;
Until(IsFishing or (Tries = 5));

Wait(500+Random(250));
While IsFishing Do
AntiBan;
FindNormalRandoms;
Writeln('Should be fishing now');
Wait(750+Random(200));
End;

Fixed a bit why do you use a function if you don't return anything



Thank you for your help and to MasterBB Thank you for your help as well.