ScriptManagerCommands.h 871 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "ConfigCmdManager.h"
  2. #include "Console.h"
  3. void
  4. CmdScriptRunString( const Ogre::StringVector& params )
  5. {
  6. if( params.size() < 2 )
  7. {
  8. Console::getSingleton().AddTextToOutput( "Usage: /script_run_string <string>" );
  9. return;
  10. }
  11. ScriptManager::getSingleton().RunString( params[ 1 ] );
  12. }
  13. void
  14. CmdScriptRunFile( const Ogre::StringVector& params )
  15. {
  16. if( params.size() < 2 )
  17. {
  18. Console::getSingleton().AddTextToOutput( "Usage: /script_run_file <file name>" );
  19. return;
  20. }
  21. ScriptManager::getSingleton().RunFile( params[ 1 ] );
  22. }
  23. void
  24. ScriptManager::InitCmd()
  25. {
  26. ConfigCmdManager::getSingleton().AddCommand( "script_run_string", "Run script string", "", CmdScriptRunString, NULL );
  27. ConfigCmdManager::getSingleton().AddCommand( "script_run_file", "Run script file", "", CmdScriptRunFile, NULL );
  28. }