Code: Select all
Program TrackingUP;
{$Include 'all.inc'}
const
FarMessage = 'Targeting cancelled.';
var
ctime : TDateTime;
k, m : integer;
procedure GotoXY(x,y,prec : integer; runflag : boolean);
// x,y - координаты, в которые идем
// prec - точность подхода
// runflag - бежать или идти
// v. 1.04 (с) Edred, скрипт портирован с инжекта
// оригинальная версия Yoko с доработкой AGRS и Edred.
var ld, ldc, dx, dy, mx, my : Integer;
begin
ld := 0; ldc := 0;
while true do
begin
dx := GetX(self) - x; if dx < 0 then dx := 0 - dx;
dy := GetY(self) - y; if dy < 0 then dy := 0 - dy;
if dy > dx then dx := dy;
if dx <= prec then exit;
mx := GetX(self); my := GetY(self);
dx := mx - x; if dx < 0 then dx := 0 - dx;
dy := my - y; if dy < 0 then dy := 0 - dy;
if dy > dx then dx := dy;
if dx <= prec then exit;
if ld = dx then begin
ldc := ldc + 1;
if ldc > 100 then begin addtosystemjournal( 'GotoXY: Cannot reach location!' ); exit; end;
end
else ld := dx;
waitconnection(5000);
if mx = x then begin
if my = y then exit;
// North
if my > y then begin Raw_Move(0,runflag); continue; end;
// South
Raw_Move(4,runflag); continue;
end;
if mx < x then begin
// Northeast
if my > y then begin Raw_Move(1,runflag); continue; end;
// East
if my = y then begin Raw_Move(2,runflag); continue; end;
// Southeast
Raw_Move(3,runflag); continue;
end;
// Southwest
if my < y then begin Raw_Move(5,runflag); continue; end;
// West
if my = y then begin Raw_Move(6,runflag); continue; end;
// Nortwest
Raw_Move(7,runflag); continue;
end;
end;
Begin
AutoMenu('Tracking','Animals');
k := 0;
m := 0;
while true do begin
checksave;
ctime := Now;
UseSkill('Tracking');
k := k + 1;
Wait(500)
SetWarMode(true);
Wait(200);
SetWarMode(false);
Wait(100)
if InJournalBetweenTimes(FarMessage, ctime, Now)<>-1 then m := m + 1 else m := 0;
if m = 5 then
begin
addtosystemjournal('Далеко. Подойдем ближе');
GotoXY(GetX(self),GetY(self)+1,0,false);
m := 0;
end;
if k > 50 then
begin
addtosystemjournal('Попробуем отойти дальше');
GotoXY(GetX(self),GetY(self)-1,0,false);
k := 0;
end;
if GetSkillValue('Tracking') = 1000 then exit;
end;
End.