I hope this helps ya:
SCAR Code:
{*******************************************************************************
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray;
RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer;):boolean;
By: MasterKill (started by hermpie)
Description: Finds and clicks an NPC
Use: FindAndClickNPC([123456, 345678], ['ancelot', 'Sir'], 'Talk', False, 5)
RChooseOption: if right click on npc what text to click?
*******************************************************************************}
Function FindAndClickNPC(NpcColors: TIntegerArray; UpTexts: TStringArray; RChooseOption :string; RightOrLeftNpcClick:boolean; HMTolerance: integer):boolean;
var
Coord123X, Coord123Y :Integer;
begin
repeat
if FindObjCustom(Coord123X, Coord123Y, UpTexts, NpcColors, HMTolerance) then
begin
If RightOrLeftNpcClick then
begin
Mouse(Coord123X, Coord123Y, 0, 0, True);
Result := True;
WriteLn('Found NPC');
exit;
end else
begin
Mouse(Coord123X, Coord123Y, 0, 0, False);
Wait(50 + random(100));
if ChooseOption(RChooseOption) then
begin
Result:=True;
WriteLn('Found NPC');
Exit;
end else WriteLn('NPC missclick!');
end;
end else
begin
WriteLn('not found NPC!');
Result := False;
exit;
end;
until(False)
end;
SCAR Code:
IF FindAndClickNpc([2345345, 2345324], ['masterkill'], 'talk', False, 6) THEN