SCAR Code:
{*******************************************************************************
function ClickOptionEx(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: TStringArray): Boolean;
By: Coh3n
Description: Will left click an object 9/10 times. Will right click an object
and choose the option accociated with ChooseOpt.
Valid arguments for Option: 'right', 'left', 'random'.
i.e ClickOption(x, y, 0, 0, 'random', ['Door'], ['Open']);
*******************************************************************************}
function ClickOptionEx(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: TStringArray): Boolean;
begin
if not InStrArr(Option, ['random', 'right', 'left'], False) then Exit;
Result := WaitUpTextMulti(UpText, 100 + Random(400));
if not Result then SRL_Warn;
if Option = 'random' then
if Random(10) = 1 then
Option := 'right';
else
Option := 'left';
Mouse(x, y, rx, ry, Option = 'left');
if Option = 'right' then
ChooseOptionMulti(ChooseOpt);
end;
{*******************************************************************************
function ClickOption(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: String): Boolean;
By: Coh3n
Description: Works like ClickOptionEx, but uses Strings instead of TStingArray.
*******************************************************************************}
function ClickOption(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: String): Boolean;
begin
Result := ClickOptionEx(x, y, rx, ry, Option, [UpText], [ChooseOpt]);
end;
SCAR Code:
MMouse(x, y, 4, 4);
if IsUpText('illow') then
begin
Writeln('We have found the Willow tree');
case Random(10) of
1: begin
Mouse(x, y, 0, 0, False);
Wait(80 + Random(100));
ChooseOption('hop');
end;
else
Mouse(x, y, 0, 0, True);
end;
With this much shorter code:
SCAR Code:
MMouse(x, y, 4, 4);
if ClickOption(x, y, 0, 0, 'random', 'illow', 'hop') then
Writeln('Clicked Willow tree!');
See what I mean? ;)