This is what I made awhile back for 99_'s and mine RM runner. You can change it up however you want, might need a little work since it's kinda old.
SCAR Code:
function NPCTalk(Color : TIntegerArray; UpText : array of string) : Boolean;
var
X, Y, Tries, I, looped : Integer;
NPCUpText : array of string;
NPCColor : TIntegerArray;
begin
if not LoggedIn then
Exit;
NPCColor := Color;
NPCUpText := UpText;
for i := 0 to High(Color) do
begin
Tries := 0;
OpenDoor;
if FindObjTPA(x, y, NPCColor[i], 30, 2, 15, 25, 10, NPCUpText) then
begin
Wait(100 + Random(50));
Mouse(x, y, 4, 4, False);
Wait(100 + Random(200));
ChooseOption('alk-to');
Result := True;
break;
end else
while (not FindObjTPA(x, y, NPCColor[i], 30, 2, 15, 25, 10, NPCUpText)) do
repeat
MakeCompass(IntToStr(Random(360)));
Wait(3000 + Random(1500));
Inc(Tries);
until (FindObjTPA(x, y, NPCColor[i], 30, 2, 15, 25, 10, NPCUpText)) or (Tries >= 5);
if tries >= 5 then Inc(looped);
end;
if (looped >= High(Color)) then
begin
Logout;
NextPlayer(False);
LoginPlayer;
Inc(Errors);
end;
end;
~Camo