Coh3n
2009-08-16 02:34:31
Hello, and welcome to my first every reflection suggestion thread! :D
The first function is R_ClickOption. For are more detailed description of this function please visit this thread -> ClickOption - My suggestion for Text.scar
Thanks. :)
The first function is R_ClickOption. For are more detailed description of this function please visit this thread -> ClickOption - My suggestion for Text.scar
{*******************************************************************************
function R_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 R_ClickOption(x, y, 0, 0, 'random', ['Door'], ['Open']);
*******************************************************************************}
function R_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 Exit;
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
R_ChooseActionMulti(ChooseOpt);
Wait(1000 + Random(500));
end;
{*******************************************************************************
function R_ClickOption(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: String): Boolean;
By: Coh3n
Description: Works like R_ClickOptionEx, but uses Strings instead of TStingArray.
*******************************************************************************}
function R_ClickOption(x, y, rx, ry: Integer; Option: String; UpText, ChooseOpt: String): Boolean;
begin
Result := R_ClickOptionEx(x, y, rx, ry, Option, [UpText], [ChooseOpt]);
end;
My second suggestion is just a small change to lordsaturn's function R_MouseItemID. His function always right clicks an object, then chooses the option. I just modified it slightly, so it will left click the item. :){*******************************************************************************
function R_MouseItemIDEx(ID: Integer; Option: String): Boolean;
By: R_MouseItemID by lordsaturn, modified by Coh3n
Description: Left clicks an item with the given ID.
*******************************************************************************}
function R_MouseItemIDEx(ID: Integer): Boolean;
var
Inv, x, y, ItemID, i : Integer;
B : TBox;
begin
Inv := GetInterface(149, 0);
Result := False;
for i := 0 to 27 do
begin
ItemID := SmartGetFieldArrayInt(Inv, InventoryItemIDs, i);
if (ItemID > 0) and (ItemID = ID) then
begin
Wait(80 + Random(100));
Mouse(x, y, 0, 0, True);
Break;
end;
end;
SmartFreeObject(Inv);
end;Well, that's all I have for now, thanks for reading. Please post suggestions/comments.Thanks. :)