home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 51 / PCGamer51_17Demos.iso / games / CM / CyclingManagerDemoCangas.exe / CyclingManagerDemo / scripts / common / console / console_ms.cnc < prev    next >
Text File  |  2001-04-04  |  3KB  |  69 lines

  1. //----------------------------------------------------------------------------------------------------------------//
  2. //----------------------------------------------------------------------------------------------------------------//
  3. //Console AI script 
  4. //----------------------------------------------------------------------------------------------------------------//
  5. //----------------------------------------------------------------------------------------------------------------//
  6.  
  7. //----------------------------------------------------------------------------------------------------------------//
  8. //----------------------------------------------------------------------------------------------------------------//
  9. //3D Option Create func
  10. //----------------------------------------------------------------------------------------------------------------//
  11. //----------------------------------------------------------------------------------------------------------------//
  12. func void MSCommandOption_Create ()
  13. {
  14.     var i32x id;
  15.     //1 editbox + 1 text = 2 components
  16.     SetComponentNumber(2);
  17.     
  18.     //2 is the Id of the font texture
  19.     id = InitContainer(tFontArial);
  20.     SetContainerText(id,"MS:");
  21.     SetComponentPosition(id,8,32);
  22.  
  23.     //Create the edit box for commands
  24.     oMSCommandOption.iEditCommand =    InitEditBox(tFontArial,10);
  25.     SetContainerStateFunc(oMSCommandOption.iEditCommand,TextButtonState);
  26.     SetContainerText(oMSCommandOption.iEditCommand,"");
  27.     SetComponentPosition(oMSCommandOption.iEditCommand,30,32);
  28.     SetComponentSize(oMSCommandOption.iEditCommand,100,10);
  29.     //Resize the event zone of the father
  30.     AutoResize();
  31. }
  32.  
  33.  
  34. //----------------------------------------------------------------------------------------------------------------//
  35. //----------------------------------------------------------------------------------------------------------------//
  36. //Option3D Event func
  37. //----------------------------------------------------------------------------------------------------------------//
  38. //----------------------------------------------------------------------------------------------------------------//
  39. func i32x MSCommandOption_Event (i32x _iComponentID,i32x _iEvent)
  40. {
  41.     if(_iComponentID == oMSCommandOption.iEditCommand)
  42.     {
  43.         if(_iEvent == GUI_COMPONENT_KEYDOWN )
  44.         {
  45.             if (GetLastKey() == VK_Return)
  46.             {
  47.                 //mao debug send MS command instead of print
  48.                 print("MSCommand:");
  49.  
  50.                 NetClient_SendMessage(g_oMenuServer.m_oServer,GetContainerText(oMSCommandOption.iEditCommand));
  51.                 println(GetContainerText(oMSCommandOption.iEditCommand));
  52.                 SetContainerText(oMSCommandOption.iEditCommand,"");
  53.             }
  54.         }
  55.     }
  56.     return 1;
  57. }
  58.  
  59.     //----------------------------------------------------------------------------------------------------------------//
  60.     //----------------------------------------------------------------------------------------------------------------//
  61.     //TeamPanel Init func
  62. //----------------------------------------------------------------------------------------------------------------//
  63. //----------------------------------------------------------------------------------------------------------------//
  64. func void InitMSCommandOption()
  65. {
  66.     oMSCommandOption.oFunc.pcreate = MSCommandOption_Create;
  67.     oMSCommandOption.oFunc.pevent = MSCommandOption_Event;
  68. }
  69.