SRL Archive - Help and Support

Else?


RISK

2012-02-23 11:58:10

procedure GetCompetition();
var
X, Y, I, II, III, T, maxT: Integer;
B, BB, BBB: Boolean;
begin
if (not(LoggedIn)) then
Exit;
FindNormalRandoms;

maxT := (RandomRange(25000, 35000));
B := False;
BB := False;
BBB := False;
T := 0;
I := 0;
II := 0;
III := 0;

MarkTime(T);
repeat
if (not(LoggedIn)) then
Exit;
FindNormalRandoms;

if (TimeFromMark(T) >= maxT) then
begin
ExitPlayer('We were unable to get a new competition.');
Exit;
end;

if (R_MouseTPA('Judge', 2584193, 16, 10, 10, 0.06, 0.08)) then
Break;

Write('The object is not on the screen. Waiting.');
AntiBan;
Wait(RandomRange(500, 1250));
until(False);

ClickMouse2(MOUSE_RIGHT);
Wait(RandomRange(300, 500));
if (OptionsExist(['alk-t'], False)) then
if (not(WaitOption('ete C', RandomRange(750, 1500)))) then
begin
Write('We already have a competition.');
Exit;
end;

for I := 1 to 5 do
begin
if (not(LoggedIn)) then
Exit;
FindNormalRandoms;

B := (FindText(X, Y, '1', StatChars, MCX1, MCY1, MCX2, MCY2));
if (B) then
Break;

Write('Pay confirmation not detected. Waiting.');
Wait(RandomRange(300, 500));
end;

if ((I >= 5) and (not(B))) then
begin
ExitPlayer('We were unable to get a new competition. - Chat might have messed up.');
Exit;
end;

// What to do after we have found the text '1' in the chatbox
HumanMMouse(X, Y, 2, 2);
ClickMouse2(MOUSE_LEFT);
if (not(WaitUpText('Continue', RandomRange(500, 750)))) then
begin
ExitPlayer('We were unable to confirm payment for a new competition.');
Exit;
end;

for II := 1 to 5 do
begin
if (not(LoggedIn)) then
Exit;
FindNormalRandoms;

BB := (ClickToContinue);
if (BB) then
Break;

Write('The click to continue button has not been detected. Waiting.');
Wait(RandomRange(450, 1000));
end;

if ((II >= 5) and (not(BB))) then
begin
ExitPlayer('We were unable to find or click the green click to continue button.');
Exit;
end;


// What to do after we have pressed the green click to continue button
for III := 1 to 5 do
begin
if (not(LoggedIn)) then
Exit;
FindNormalRandoms;

BBB := (FindChatBoxText('coins have', 8, clBlack));
if (BBB) then
Break;

Write('Waiting for the chat-box confirmation text.');
Wait(RandomRange(500, 1250));
end;

if ((III >= 5) and (not(BBB))) then
begin
ExitPlayer('Error in detecting the chat-box confirmation text.');
Exit;
end;

Write('We have started a new competition.');
end;

That's the procedure itself. But the line of code that I want to add an 'else' to is:
  if (OptionsExist(['alk-t'], False)) then
if (not(WaitOption('ete C', RandomRange(750, 1500)))) then
begin
Write('We already have a competition.');
Exit;
end;

I want to add the else to the first if (OptionsExist) so that I can create a fail-safe.
But I can't figure out how to do it without it giving me an 'Identifier expected' error. Am I missing something?


Thanks in advance for any help for this embarrassing question. :redface: I really appreciate it!

masterBB

2012-02-23 12:01:16

I believe its like this:

if (OptionsExist(['alk-t'], False)) then
if (not(WaitOption('ete C', RandomRange(750, 1500)))) then
begin
Write('We already have a competition.');
Exit;
end
else

RISK

2012-02-23 12:02:39

Yeah, I tried that too but it gives me that 'Identifier expected' error when I try it. Also when I try to add a begin end after it, it still does it. So I'm sort of lost. The only time it works is when I remove the second if .. then nest for some reason.

masterBB

2012-02-23 12:05:54

const
a = 3;
b = 6;
c = 3;

begin
if a < b then
begin
if c = a then
begin
writeln('coooool');
writeln('do some stuff');
end;
end
else
writeln('tada');
end.

Kyle Undefined

2012-02-23 12:06:03


if (OptionsExist(['alk-t'], False)) then
begin
if (not(WaitOption('ete C', RandomRange(750, 1500)))) then
begin
Write('We already have a competition.');
Exit;
end;
end else

Like this?

RISK

2012-02-23 12:08:06

Hah, thanks a lot! I really appreciate you two.
Have a Fluttershy: