现在的位置: 首页 > 综合 > 正文

制作小精灵代码(c++biuder 6)

2012年06月24日 ⁄ 综合 ⁄ 共 6142字 ⁄ 字号 评论关闭
我用c++biuder   5制作小精灵是可以通过,可是c++biuder   6时总是跳不过去,总是说TAgent未定义,那位有做过的代码请给我一份,或提示我怎样调通。
问题点数:100、回复次数:23

4楼  constantine   (飘遥的安吉儿) 四星用户 该版得分小于等于100000分,大于50000分  回复于 2005-06-13 15:39:15  得分 70
首先确认安装了,之后看一下这段代码  
  //---------------------------------------------------------------------------  
   
  #include   <vcl.h>  
  #pragma   hdrstop  
   
  #include   "Unit1.h"  
  //---------------------------------------------------------------------------  
  #pragma   package(smart_init)  
  #pragma   link   "AgentObjects_OCX"  
  #pragma   resource   "*.dfm"  
  TForm1   *Form1;  
  //---------------------------------------------------------------------------  
  __fastcall   TForm1::TForm1(TComponent*   Owner)  
                  :   TForm(Owner)  
  {  
  load=false;  
   
  }  
  //---------------------------------------------------------------------------  
   
  void   __fastcall   TForm1::Button1Click(TObject   *Sender)  
  {  
  if(load==false)  
  {  
  if(OpenDialog1->Execute())  
  {  
  wact="a";  
  act=wact;  
  char   tmp[100];  
  GetWindowsDirectory(tmp,100);  
  path=OpenDialog1->FileName;  
  try  
  {  
  Agent1->Characters->Load(act,path);  
  }  
  catch(...)  
  {  
  ShowMessage("不能正常载入精灵助手!");  
  return;  
  }  
  numan=Agent1->Characters->Character(act);  
  numan->Show(0);  
  talk="大家好,我是精灵助手,有什么疑问尽管问我好了!";  
  numan->Speak(talk,"");  
  load=true;  
  }  
  }  
  else  
  ShowMessage("精灵助手已经载入了,请不要重复加载!");  
  }  
  //---------------------------------------------------------------------------  
  void   __fastcall   TForm1::Button2Click(TObject   *Sender)  
  {  
  if(load==true)  
  {  
  talk="Bye   bye   我走了!";  
  numan->Speak(talk,"");  
  Sleep(1000);  
  Agent1->Characters->Unload(act);  
  load=false;  
  }  
  else  
  ShowMessage("请先载入精灵助手!");  
  }  
  //---------------------------------------------------------------------------  
  WideString   tmpact[28]={"Acknowledge","LookDown",  
  "Sad","Alert","LookDownBlink","Search","Announce",  
  "LookUp","Blink","LookUpBlink","Confused",  
  "LookLeft","Suggest","Congratulate","LookLeftBlink",  
  "Surprised","Decline","LookRight","Think",  
  "DontRecognize","LookRightBlink","Wave","Explain",  
  "Write","Pleased","Read","Greet","RestPose"};  
   
  void   __fastcall   TForm1::RadioGroup1Click(TObject   *Sender)  
  {  
  if(load==true)  
  {  
   
  BSTR   active=tmpact[RadioGroup1->ItemIndex];  
  try  
    {  
      numan->Play(active);  
      talk="我现在正在"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"呢!";  
      numan->Speak(talk,"");  
      }  
  catch(...)  
    {  
      talk="对不起,没有"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"这个动作!";  
      numan->Speak(talk,"");  
    }  
  }  
  else  
  ShowMessage("请先载入精灵助手!");  
  }  
  //---------------------------------------------------------------------------  
   
  void   __fastcall   TForm1::Button3Click(TObject   *Sender)  
  {  
  if(load==true)  
  {  
  talk="我要藏起来了!";  
  numan->Speak(talk,"");  
  numan->Hide(0);  
  }  
  else  
  ShowMessage("请先载入精灵助手!");  
  }  
  //---------------------------------------------------------------------------  
   
  void   __fastcall   TForm1::Button4Click(TObject   *Sender)  
  {  
   
  if(load==true)  
  {  
  numan->Show(0);  
  talk="嘿嘿,我又来了!";  
  numan->Speak(talk,"");  
  }  
  else  
  ShowMessage("请先载入精灵助手!");  
  }  
  //---------------------------------------------------------------------------  
   
 

Top

抱歉!评论已关闭.