Shuttleu
2010-12-02 09:10:44
With the current R_ChooseOptionMulti, it will choose the first option which has one of the "Options"
This will make sure that all the "Options" are in the option that it chooses
~shut
This will make sure that all the "Options" are in the option that it chooses
{*******************************************************************************
function R_ChooseOptionMulti(Options : TStringArray) : Boolean;
By: Drags111, Shuttleu - Based off nava2's and Lordsaturns.
Description: Chooses the first found option of "Options" from the Right
Click menu, returns True and Clicks if found, else it will Move the
mouse to a random Coord or select cancel.
*******************************************************************************}
function R_ChooseOptionMulti(Options : TStringArray) : Boolean;
var
ThisOption: Boolean;
i, i2, xOff, yOff, t: Integer;
P : TPoint;
MenuOptions: TStringArray;
begin
Result := False;
if not IsMenuOpen then
begin
MarkTime(t);
while(TimeFromMark(t) < 1000)do ;
if not IsMenuOpen then Exit;
end;
P := Point(SmartGetFieldInt(0, hook_static_MenuX) + 4, SmartGetFieldInt(0, hook_static_MenuY) + 4);
//Writeln('MenuX: '+ToStr(SmartGetFieldInt(0, hook_static_MenuX)));
//Writeln('MenuY: '+ToStr(SmartGetFieldInt(0, hook_static_MenuY)));
MenuOptions := GetMenuText;
for i := 0 to High(MenuOptions) do
begin
Result:= True;
for i2 := 0 to High(Options) do
begin
ThisOption:= (Pos(Lowercase(Options[i2]), Lowercase(MenuOptions[i])) <> 0);
Result:= (ThisOption and Result);
end;
if Result begin
xOff := RandomRange(4, 4 + Random(Length(MenuOptions[i]) * 4 - 4));
yOff := 21 + (16 * i) + RandomRange(2, 10);
Mouse(P.x + xOff, P.y + yOff, 0, 0, True);
Wait(RandomRange(80, 100));
Result := not IsMenuOpen;
Exit;
end;
end;
case Random(2) of
0: R_ChooseOptionMulti(['Cancel']);
1: while IsMenuOpen do
begin
MMouse(Random(MSX2), Random(MSY2), 0, 0);
Wait(RandomRange(100, 200));
end;
end;
end; ~shut