Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit UserScript;
- const
- sSignature = 'ACHR';
- targetX = 74770.671875;
- targetY = -59106.628906;
- targetZ = 1301.145020;
- fRadius = 8000.0;
- var
- sl: TStringList;
- function Initialize: Integer;
- begin
- sl := TStringList.Create;
- end;
- function DistanceFromTarget(e: IInterface): Real;
- var
- eX, eY, dX, dY: Real;
- begin
- eX := StrToFloat(GetElementEditValues(e, 'DATA\Position\X'));
- eY := StrToFloat(GetElementEditValues(e, 'DATA\Position\Y'));
- dX := targetX - eX;
- dY := targetY - eY;
- Result := dX * dX + dY * dY;
- end;
- function Process(e: IInterface): Integer;
- var
- fDistance, fRadiusSq: Real;
- npcRecord: IInterface;
- begin
- if Signature(e) <> sSignature then
- exit;
- fDistance := DistanceFromTarget(e);
- fRadiusSq := fRadius * fRadius;
- if fDistance < fRadiusSq then begin
- npcRecord := LinksTo(ElementByPath(e, 'NAME'));
- sl.Add(Format('%s :: Distance = %0.3f',
- [Name(npcRecord), Sqrt(fDistance)]));
- end;
- end;
- function Finalize: Integer;
- begin
- sl.SaveToFile(sSignature+' Nearby.txt');
- sl.Free;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment