Procházet zdrojové kódy

correct the %dedicated var in function parseArgs()
-it's supposed to be a global like the rest.
also by request, added a help.txt file dump to the -help cli arg

AzaezelX před 3 roky
rodič
revize
8a71a6141f

+ 18 - 12
Templates/BaseGame/game/core/utility/scripts/helperFunctions.tscript

@@ -499,18 +499,24 @@ function displayHelp()
    // (flushing the write buffer) after every write.
    // -log 2 overwrites any existing logfile; it also only closes
    // the logfile when the application shuts down.  (default)
-
-   error(
-      "Torque Demo command line options:\n"@
-      "  -log <logmode>         Logging behavior; see main." @ $TorqueScriptFileExtension @ " comments for details\n"@
-      "  -game <game_name>      Reset list of mods to only contain <game_name>\n"@
-      "  <game_name>            Works like the -game argument\n"@
-      "  -dir <dir_name>        Add <dir_name> to list of directories\n"@
-      "  -console               Open a separate console\n"@
-      "  -jSave  <file_name>    Record a journal\n"@
-      "  -jPlay  <file_name>    Play back a journal\n"@
-      "  -help                  Display this help message\n"
-   );
+   
+     %helpstring = "Torque Demo command line options:\n";
+     %helpstring =%helpstring @ "  -log <logmode>         Logging behavior; see main." @ $TorqueScriptFileExtension @ " comments for details\n";
+     %helpstring =%helpstring @ "  -game <game_name>      Reset list of mods to only contain <game_name>\n";
+     %helpstring =%helpstring @ "  <game_name>            Works like the -game argument\n";
+     %helpstring =%helpstring @ "  -dir <dir_name>        Add <dir_name> to list of directories\n";
+     %helpstring =%helpstring @ "  -console               Open a separate console\n";
+     %helpstring =%helpstring @ "  -jSave  <file_name>    Record a journal\n";
+     %helpstring =%helpstring @ "  -jPlay  <file_name>    Play back a journal\n";
+     %helpstring =%helpstring @ "  -help                  Display this help message\n";
+      
+   error(%helpstring);
+   
+   %file = new FileObject();
+   if(%file.openForWrite("help.txt"))
+      %file.writeLine(%helpstring);
+   %file.close();
+   %file.delete();
 }
 
 // Execute startup scripts for each mod, starting at base and working up

+ 4 - 4
Templates/BaseGame/game/core/utility/scripts/parseArgs.tscript

@@ -55,7 +55,7 @@ function parseArgs()
       {
          $userDirs = $defaultGame;
          $dirCount = 1;
-         %isDedicated = true;
+         $isDedicated = true;
       }*/
 
       switch$ ($arg)
@@ -64,7 +64,7 @@ function parseArgs()
          case "-dedicated":
             $userDirs = $defaultGame;
             $dirCount = 1;
-            %isDedicated = true;
+            $isDedicated = true;
             $Server::Dedicated = true;
             enableWinConsole(true);
             $argUsed[%i]++;
@@ -138,7 +138,7 @@ function parseArgs()
             {
                // Set the selected dir --NOTE: we no longer allow tools with this argument
                /*
-               if( %isDedicated )
+               if( $isDedicated )
                {
                   $userDirs = $nextArg;
                   $dirCount = 1;
@@ -311,7 +311,7 @@ function parseArgs()
          case "-help":
             $displayHelp = true;
             $argUsed[%i]++;
-
+            displayHelp();
          //-------------------
          case "-compileAll":
             $compileAll = true;

+ 1 - 1
Templates/BaseGame/game/main.tscript.in

@@ -44,7 +44,7 @@ if(isFunction("loadStartup"))
 else
 {
    //If nothing else set a main menu, try to do so now
-   if(!isObject(Canvas.getContent()))
+   if(isObject(Canvas) || !isObject(Canvas.getContent()))
    {
       if (isObject( ProjectSettings.value("UI/mainMenuName") ))
          Canvas.setContent( ProjectSettings.value("UI/mainMenuName") );