Here, just use my code.
Simba Code:
function InteractWithNPC(action:string;npc:TNPC):boolean;
var t:TNPC;
begin
if not TileOnMS(npc.tile,30) then
begin
WalkToTile(npc.tile,1,1);
R_Flag;
end;
MoveBox(PtToBox(TileToMS(npc.tile,30),10));
Wait(100+random(125));
if R_IsUpText(action+' '+npc.name) then
ClickMouse2(true)
else
begin
ClickMouse2(false);
R_ChooseOptionMulti([action,npc.name]);
end;
wait(400+random(150));
r_Flag;
result := InteractingWithMe(npc);
end;
procedure FinishAnimating();
var i:integer;
begin
for i := 0 to 16 do
begin
if CharacterAnimating then i := 0;
wait(40);
end;
end;
function FightNPC(name:string):boolean;
var mobs:TNPCArray;
index:integer;
begin
index := 0;
mobs := SortNPCs(GetNPCs(name));
for index := 0 to high(mobs) do
begin
if (mobs[index].fighting or mobs[index].moving) then
continue;
result := InteractWithNPC('attack',mobs[index]);
FinishAnimating;
break;
end;
end;
Here's the mouse functions I used:
Simba Code:
function MouseInBox(box:TBox):boolean;
var pt:TPoint;
begin
GetMousePos(pt.x,pt.y);
result := PointInBox(pt, box);
end;
procedure ClickBox(box:TBox;left:boolean);
var x,y:integer;
begin
x := (box.x2 - box.x1)/2;
y := (box.y2 - box.y1)/2;
if not MouseInBox(box) then
MMouse(box.x1 + x + Random(RandomRange(-x,x)), box.y1 + y + Random(RandomRange(-y,y)), 0, 0);
ClickMouse2(left);
end;
procedure MoveBox(box:TBox);
var x,y:integer;
begin
x := (box.x2 - box.x1)/2;
y := (box.y2 - box.y1)/2;
if not MouseInBox(box) then
MMouse(box.x1 + x + Random(RandomRange(-x,x)), box.y1 + y + Random(RandomRange(-y,y)), 0, 0);
end;