unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    CategoryEdt: TEdit;
    Label2: TLabel;
    ProgEdt: TEdit;
    Label3: TLabel;
    PosXEdt: TEdit;
    Label4: TLabel;
    PosYEdt: TEdit;
    Label5: TLabel;
    RadiusEdt: TEdit;
    Memo1: TMemo;
    Button1: TButton;
    Label6: TLabel;
    StartEdt: TEdit;
    Label7: TLabel;
    CountEdt: TEdit;
    Label8: TLabel;
    DelayEdt: TEdit;
    Label9: TLabel;
    ParamsEdt: TEdit;
    InfoLbl: TLabel;
    Label10: TLabel;
    MultiplyEdt: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure StartEdtChange(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var i,j:word; posx, posy:integer; r:single;
begin
 Memo1.Lines.Clear;
 for i := 0 to StrToInt(CountEdt.Text)-1 do begin
  for j := 1 to StrToInt(MultiplyEdt.Text) do begin
   r := Random(3140)/1000;
   posx := Round(cos(r)*Random(StrToInt(RadiusEdt.Text))+StrToInt(PosXEdt.Text));
   posy := Round(sin(r)*Random(StrToInt(RadiusEdt.Text))+StrToInt(PosYEdt.Text));
   Memo1.Lines.Add('CreateObject pos='+IntToStr(posx)+';'+IntToStr(posy)+
    ' dir='+IntToStr(Random(2))+'.'+IntToStr(Random(10))+
    ' type=AlienEgg autoValue1='+IntToStr(i*StrToInt(DelayEdt.Text)+
    StrToInt(StartEdt.Text))+' autoType='+CategoryEdt.Text+' autoString="'+
    ProgEdt.Text+'" run=1 '+ParamsEdt.Text);
  end;
 end;
end;

procedure TForm1.StartEdtChange(Sender: TObject);
var t:word;
begin
 try
  t := (StrToInt(CountEdt.Text)-1)*StrToInt(DelayEdt.Text);
  InfoLbl.Caption := 'Wykluje się '+
   IntToStr(StrToInt(CountEdt.Text)*StrToInt(MultiplyEdt.Text))+' Obcych. '+
   'Seria będzie trwała '+IntToStr(t)+
   's i zakończy się w '+IntToStr(t+StrToInt(StartEdt.Text))+' sek.';
 except
  InfoLbl.Caption := 'Niepoprawne dane . . .';
 end;
end;

end.
