Game Development Community

Command line arguments?

by Jacob Wagner · in Torque Game Builder · 05/29/2010 (2:39 pm) · 1 replies

Where can I get a list of command line arguments? The one I'm looking for is something like
-startWithoutEditors

I can't believe I couldn't find this in the documentation (in which the search function is broken), or on TDN, or through forum searches, or through google searches, though I didn't spend a ton of time.


#1
06/11/2010 (9:50 am)
So you can see and add them in common/main.cs under the parseArgs function:

//---------------------------------------------------------------------------------------------
// parseArgs
// Parses the command line arguments and processes those valid for this mod.
//---------------------------------------------------------------------------------------------
function parseArgs()
{
   // Let the parent grab the arguments it wants first.
   Parent::parseArgs();

   // Loop through the arguments.
   for (%i = 1; %i < $Game::argc; %i++)
   {
      %arg = $Game::argv[%i];
      %nextArg = $Game::argv[%i+1];
      %hasNextArg = $Game::argc - %i > 1;
   
      switch$ (%arg)
      {
         case "-fullscreen":
            $pref::Video::fullScreen = 1;
            $argUsed[%i]++;

         case "-windowed":
            $pref::Video::fullScreen = 0;
            $argUsed[%i]++;

         case "-openGL":
            $pref::Video::displayDevice = "OpenGL";
            $argUsed[%i]++;

         case "-directX":
            $pref::Video::displayDevice = "D3D";
            $argUsed[%i]++;

         case "-voodoo2":
            $pref::Video::displayDevice = "Voodoo2";
            $argUsed[%i]++;

         case "-autoVideo":
            $pref::Video::displayDevice = "";
            $argUsed[%i]++;

         case "-prefs":
            $argUsed[%i]++;
            if (%hasNextArg) {
               exec(%nextArg, true, true);
               $argUsed[%i+1]++;
               %i++;
            }
            else
               error("Error: Missing Command Line argument. Usage: -prefs <path/script.cs>");
      }
   }
}

Not quite sure what you want with a "startWithoutEditors" If you want to just launch the game you can go to your project file, if upon project creation you checked "Copy Game Executable to Game Path" you'll have an .exe there, if not you can copy one over like this:

1) Go to your TGB Install directory and into tgb\gameData\T2DProject
(On my Windows 7 machine the full path is: C:\Program Files (x86)\Torque\Torque Game Builder 1.7.5 Pro\tgb\gameData\T2DProject)

2) Copy TGBGame.exe

3) Paste it into your project folder, right in the base directory next to the main.cs and .dll files.

Now you can run the .exe and run your game without the editors (the editor script folders aren't there at all, just your game) without having to publish it to test it.