.如果真 (单选框2.选中 = 真)
    .如果 (生成数量 = 1)
        文本 = “<NPC ai_class=” + #引号 + 编辑框1.内容 + #引号 + “ ” + “x=” + #引号 + 编辑框2.内容 + #引号 + “ ” + “y=” + #引号 + 编辑框3.内容 + #引号 + “ ” + “z=” + #引号 + 编辑框4.内容 + #引号 + “ ” + “pitch=” + #引号 + 编辑框5.内容 + #引号 + “ ” + “yaw=” + #引号 + 编辑框6.内容 + #引号 + “ ” + “/>”
        写到文件 (取运行目录 () + “\123.txt”, 到字节集 (文本))
    .否则
        文本 = “”
        .计次循环首 (生成数量, )
            .如果 (组合框1.现行选中项 = 0)
                Y坐标 = Y坐标 + 间隔
            .否则
                Y坐标 = Y坐标 - 间隔
            .如果结束
            文本 = 文本 + “<NPC ai_class=” + #引号 + 编辑框1.内容 + #引号 + “ ” + “x=” + #引号 + 到文本 (X坐标) + #引号 + “ ” + “y=” + #引号 + 到文本 (Y坐标) + #引号 + “ ” + “z=” + #引号 + 编辑框4.内容 + #引号 + “ ” + “pitch=” + #引号 + 编辑框5.内容 + #引号 + “ ” + “yaw=” + #引号 + 编辑框6.内容 + #引号 + “ ” + “/>” + #换行符
            调试输出 (文本)
        .计次循环尾 ()
        写到文件 (取运行目录 () + “\123.txt”, 到字节集 (文本))
    .如果结束    信息框 (“生成成功”, 0, “成功”)
---------------------------------------------------------------------------------------
新学DELPHI,不知道该如何把E语言专程DELPHI的,请各位帮帮忙。

解决方案 »

  1.   

    虽然csdn里估计没几人看过e,各编程语言的逻辑都是一样的,靠你自己了
      

  2.   

    var
     s: string;//文本
     icount: integer;//生成数量if radiobox2.checked and icount = 1 then
     begin
      s := "<NPC ai_class=" + #引号 +Edit1.Text + #引号 + " " + "x=" + #引号 + Edit2.Text + #引号 + " " + “y=" + #引号 + Edit3.Text + #引号 + " " + “z=" + #引号 + Edit4.Text + #引号 + " " + "pitch=” + #引号 + Edit5.Text + #引号 + " " + “yaw=" + #引号 + Edit6.Text + #引号 + " " + "/>";
    end;
      
    .....
      

  3.   

    朋友,编译不通过啊,还有循环在哪里呢?
    s := '<NPC ai_class=' +Edit1.Text+'x='+ Edit2.Text+' y='+ Edit3.Text+'z='+Edit4.Text+'pitch="0" yaw='+edit6.Text+'"/>';
      

  4.   

    那个循环是怎么回事?是while还是for??
      

  5.   


     .计次循环首 (生成数量, )
                .如果 (组合框1.现行选中项 = 0)
                    Y坐标 = Y坐标 + 间隔
                .否则
                    Y坐标 = Y坐标 - 间隔
                .如果结束
                文本 = 文本 + “<NPC ai_class=” + #引号 + 编辑框1.内容 + #引号 + “ ” + “x=” + #引号 + 到文本 (X坐标) + #引号 + “ ” + “y=” + #引号 + 到文本 (Y坐标) + #引号 + “ ” + “z=” + #引号 + 编辑框4.内容 + #引号 + “ ” + “pitch=” + #引号 + 编辑框5.内容 + #引号 + “ ” + “yaw=” + #引号 + 编辑框6.内容 + #引号 + “ ” + “/>” + #换行符
                调试输出 (文本)
            .计次循环尾 ()
            写到文件 (取运行目录 () + “\123.txt”, 到字节集 (文本))
    这个是E语言的循环,然后生成文本。不知道怎么换成DELPHI的写出来。
      

  6.   

    .计次循环首 (生成数量, )
                .如果 (组合框1.现行选中项 = 0)
                    Y坐标 = Y坐标 + 间隔
                .否则
                    Y坐标 = Y坐标 - 间隔
                .如果结束
                文本 = 文本 + “<NPC ai_class=” + #引号 + 编辑框1.内容 + #引号 + “ ” + “x=” + #引号 + 到文本 (X坐标) + #引号 + “ ” + “y=” + #引号 + 到文本 (Y坐标) + #引号 + “ ” + “z=” + #引号 + 编辑框4.内容 + #引号 + “ ” + “pitch=” + #引号 + 编辑框5.内容 + #引号 + “ ” + “yaw=” + #引号 + 编辑框6.内容 + #引号 + “ ” + “/>” + #换行符
                调试输出 (文本)
            .计次循环尾 ()
            写到文件 (取运行目录 () + “\123.txt”, 到字节集 (文本))
    这个是E语言的循环,然后生成文本。不知道怎么换成DELPHI的写出来。
      

  7.   

    中文变量名换成英文变量名,等号前面加冒号,循环改成for循环,写文件变成对应函数。
      

  8.   

    只是把中文翻译成英文 易转DELPHI还是比较容易
      

  9.   


    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        btn1: TButton;
        btn2: TButton;
        rb1: TRadioButton;  //   单选框1
        rb2: TRadioButton;  //   单选框2
        cbb1: TComboBox;    //  组合框1
        edt1: TEdit;       // 编辑框1
        edt2: TEdit;       // 编辑框2
        edt3: TEdit;       // 编辑框3
        edt4: TEdit;      //  编辑框4
        edt5: TEdit;      //  编辑框5
        edt6: TEdit;      //  编辑框6
        procedure btn1Click(Sender: TObject);
        procedure btn2Click(Sender: TObject);
      private
        { Private declarations }
        shengchengshuliang : Integer;  // 生成数量 应该是个全局变量,应该初始化
        posX : Integer;         //Y坐标  应该是个全局变量,应该初始化
        posY : Integer;         //X坐标 应该是个全局变量,应该初始化
        jg : Integer;          //间隔  应该是个全局变量,应该初始化
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure TForm1.btn2Click(Sender: TObject);
    var
      strs : TStringStream;
      ms : TMemoryStream;
      str1 : String;   //文本
      CurrentPath : string;
      i : Integer;
    begin
      CurrentPath := ExtractFilePath(ParamStr(0));  //取得当前程序运行路径
      strs := TStringStream.Create('你好');
      ms := TMemoryStream.Create;
      try
        if rb2.checked then
        begin
          if shengchengshuliang = 1 then
          begin
            str1 := '<NPC ai_class="'  + edt1.Text + '" ' + 'x="' + edt2.Text + '" y="' + edt3.Text + '" z="' +  edt4.Text  + '" pitch="' + edt5.Text + '" yaw="' + edt6.Text + '" />';        strs.WriteString(str1);
            strs.Position := 0;
            ms.LoadFromStream(strs);
            ms.SaveToFile(CurrentPath + '123.txt');
          end
          else
          begin
            str1 := '';
            for i := 1 to shengchengshuliang do
            begin
              if cbb1.ItemIndex = 0 then
              begin
                posY := posY + jg;
              end
              else
              begin
                posY := posY - jg;
              end;
              str1 := '<NPC ai_class="'  + edt1.Text + '" ' + 'x="' + IntToStr(posX) + '" y="' + IntToStr(posY) + '" z="' +  edt4.Text  + '" pitch="' + edt5.Text + '" yaw="' + edt6.Text + '" />' +#13#10;
              //调试输出 (文本) **忽略** 此处代码为调试用,故不写
            end;        strs.WriteString(str1);
            strs.Position := 0;
            ms.LoadFromStream(strs);
            ms.SaveToFile(CurrentPath + '123.txt');
          end;    end;    MessageBox(handle, Pchar('生成成功'), '成功', MB_ICONINFORMATION + MB_OK);
      finally
        FreeAndNil(strs);
        FreeAndNil(ms);
      end;
      end;
    //此处btn1Click代码没用
    procedure TForm1.btn1Click(Sender: TObject);
    var
      strs : TStringStream;
      ms : TMemoryStream;
    begin
      strs := TStringStream.Create('你好');
      ms := TMemoryStream.Create;
      ms.LoadFromStream(strs);
      ms.SaveToFile('d:\1.txt');
    end;
    end.