Ketan
2012-09-05 03:06:49
I made a simple method to find a NPC. I'm getting a slight problem. Sometimes, I get a bug that makes the bot do this procedure again and again even after the writeln('whatever…'); is passed in the debug.
That means when Exit; is called, it does the method again. It's random kind of… Sometimes it don't, but when it do so, it doesn't stop.
[NOTE]: I've replaced few stuff in code, just to make my script un-guess-able, I wanna keep it private.
Help is appreciated.
That means when Exit; is called, it does the method again. It's random kind of… Sometimes it don't, but when it do so, it doesn't stop.
[NOTE]: I've replaced few stuff in code, just to make my script un-guess-able, I wanna keep it private.
procedure TalkToNPC;
var
X, Y : Integer;
begin
MakeCompass('N');
X:=MSCX;
Y:=MSCY;
if FindObjTPA(X, Y, 4604739, 13, 1, 4, 9, 20, ['some npc']) then
begin;
Writeln('Looking for some npc...');
GetMousePos(X, Y);
Mouse(X, Y, 5, 5, False);
while not (WaitOption('Talk-to', 300)) do TalkToNPC;
Writeln('We found the npc!');
wait(2000+random(500));
while (AreTalking()) do
begin
KeyDown(50);
clickContinue(true, true);
wait(500+random(500));
end;
wait(1000+random(1000));
if (FindChatBoxText('received message', 8, clBlack)) then
Writeln('whatever....');
Exit;
end;
end;Help is appreciated.