Game Development Community

level will not load

by Gary Roberson · in Torque Game Engine · 11/19/2009 (8:21 pm) · 8 replies

I've worked on this problem for over a week now, and can't seem to resolve it.
I have a simple Main GUI created with four buttons.
Like the 'Getting Started' pamphlet describes I have the 'loadMyMission()' instruction in the 'command' section of the IDE. but the level will not load.

I DO have in the main.cs file in the examples folder the $defaultGame line set to my Game folder. TheChosen
I DID in the main.cs file in my Game folder set the mission file to my mission level. chosen.mis instead of flat.mis.

The thing is when i run from the console, and type in loadMyMission on the cmd line, it loads. It will also load if I press the F11 key, but it will not load from one of the buttons on the MainMenuGui screen.

Here is some of the code from the respective files!

Here is the main.cs file from the TheChosen file ( NOT the Examples folder)

//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

// Load up common script base
loadDir("common");

//-----------------------------------------------------------------------------

// Load up default console values.
exec("./client/defaults.cs");
exec("./server/defaults.cs");

// Preferences (overide defaults)
exec("./prefs.cs");


//-----------------------------------------------------------------------------
// Package overrides to initialize the game
package ttb {

function onStart()
{
   // Initialize the client and the server
   Parent::onStart();
   initServer();
   initClient();
   $Editor::newMissionOverride = "TheChosen/data/missions/chosen.mis";
}

function onExit()
{
   // Save off our current preferences for next time
   echo("Exporting prefs");
   export("$Pref::*", "./prefs.cs", False);
   Parent::onExit();
}

}; // Client package
activatePackage(ttb);


//-----------------------------------------------------------------------------

function initServer()
{
   echo("\n--------- Initializing TTB: Server ---------");

   // The common module provides the basic server functionality
   initBaseServer();

   // Load up game server support scripts
   exec("./server/game.cs");
}


//-----------------------------------------------------------------------------

function initClient()
{
   echo("\n--------- Initializing TTB: Client ---------");

   // The common module provides basic client functionality
   initBaseClient();

   // InitCanvas starts up the graphics system.
   // The canvas needs to be constructed before the gui scripts are
   // run because many of the controls assume the canvas exists at
   // load time.
   initCanvas("The Chosen");

   // Load client-side Audio Profiles/Descriptions
   exec("./client/audioProfiles.cs");

   // Load up the shell and game GUIs
   exec("./client/ui/PlayGui.gui");
   exec("./client/ui/mainMenuGui.gui");
   exec("./client/ui/optionsDlg.gui");
   exec("./client/ui/loadingGui.gui");

   // Client scripts
   exec("./client/optionsDlg.cs");
   exec("./client/missionDownload.cs");
   exec("./client/serverConnection.cs");
   exec("./client/loadingGui.cs");
   exec("./client/playGui.cs");
   exec("./client/clientGame.cs");

   // Default player key bindings
   exec("./client/default.bind.cs");

   // Copy saved script prefs into C++ code.
   setShadowDetailLevel( $pref::shadows );
   setDefaultFov( $pref::Player::defaultFov );
   setZoomSpeed( $pref::Player::zoomSpeed );

   // Start up the main menu...
   Canvas.setContent(MainMenuGui);
   Canvas.setCursor("DefaultCursor");
}


//-----------------------------------------------------------------------------
// LOAD MY MISSION

function loadMyMission()
{
   // make sure we are not connected to a server already
   disconnect();

   // Create the server and load the mission
   createServer("SinglePlayer", expandFilename("TheChosen/data/missions/chosen.mis"));

   // Make a local connection
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs("Player");
   %conn.setJoinPassword("None");
   %conn.connectLocal();
}

and now the chosen.mis file...

//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
   canSaveDynamicFields = "1";

   new ScriptObject(MissionInfo) {
         desc0 = "The tutorial base example mission. This mission contains a minimal set of example art and textures.";
         name = "F World";
   };
   new MissionArea(MissionArea) {
      canSaveDynamicFields = "1";
      Area = "-360 -648 720 1296";
      flightCeiling = "300";
      flightCeilingRange = "20";
         locked = "true";
   };
   new TSStatic(gardenA) {
      canSaveDynamicFields = "1";
      position = "-0.112414 -431.977 0.25";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      shapeName = "~/data/shapes/Chosen/qgarden90.dts";
   };
   new Sky(Sky) {
      canSaveDynamicFields = "1";
      position = "336 136 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      materialList = "~/data/skies/sky_day.dml";
      cloudHeightPer[0] = "0.349971";
      cloudHeightPer[1] = "0.25";
      cloudHeightPer[2] = "0.199973";
      cloudSpeed1 = "0.0001";
      cloudSpeed2 = "0.0002";
      cloudSpeed3 = "0.0003";
      visibleDistance = "500";
      fogDistance = "300";
      fogColor = "0.82 0.828 0.844 1";
      fogStorm1 = "0";
      fogStorm2 = "0";
      fogStorm3 = "0";
      fogVolume1 = "300 0 71";
      fogVolume2 = "0 0 0";
      fogVolume3 = "0 0 0";
      fogVolumeColor1 = "128 128 128 -2.22768e+038";
      fogVolumeColor2 = "128 128 128 0";
      fogVolumeColor3 = "128 128 128 -1.70699e+038";
      windVelocity = "1 1 0";
      windEffectPrecipitation = "1";
      SkySolidColor = "0.547 0.641 0.789 0";
      useSkyTextures = "1";
      renderBottomTexture = "0";
      noRenderBans = "0";
         locked = "true";
   };
   new Sun() {
      canSaveDynamicFields = "1";
      azimuth = "0";
      elevation = "35";
      color = "0.988 0.985 0.98 1";
      ambient = "0.5 0.5 0.5 1";
         direction = "0.57735 0.57735 -0.57735";
         scale = "1 1 1";
         position = "0 0 0";
         rotation = "1 0 0 0";
         locked = "true";
   };
   new TerrainBlock(Terrain) {
      canSaveDynamicFields = "1";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      terrainFile = "./chosen.ter";
      squareSize = "8";
      emptySquares = "407938 408194 408450 96928 99744 443522 443778 444034";
      bumpScale = "1";
      bumpOffset = "0.01";
      zeroBumpScale = "8";
      tile = "1";
         position = "-1024 -1024 0";
         locked = "true";
   };
   new SimGroup(PlayerDropPoints) {
      canSaveDynamicFields = "1";

      new SpawnSphere() {
         canSaveDynamicFields = "1";
         position = "23.1063 -410.857 166.036";
         rotation = "0 0 1 130.062";
         scale = "1 1 1";
         dataBlock = "SpawnSphereMarker";
         radius = "100";
         sphereWeight = "100";
         indoorWeight = "100";
         outdoorWeight = "100";
            lockCount = "0";
            homingCount = "0";
            locked = "False";
      };
   };
   new SimGroup(Chosen) {
      canSaveDynamicFields = "1";

      new SimGroup(buildings) {
         canSaveDynamicFields = "1";

         new InteriorInstance(courtyard) {
            canSaveDynamicFields = "1";
            position = "-14.9402 -399.871 -3.25";
            rotation = "1 0 0 0";
            scale = "10 10 1";
            interiorFile = "~/data/interiors/Chosen/courtyard2.dif";
            useGLLighting = "0";
            showTerrainInside = "0";
         };
         new InteriorInstance(MainBuilding) {
            canSaveDynamicFields = "1";
            position = "13.2477 -416.28 0.23496";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            interiorFile = "~/data/interiors/Chosen/mainbuilding.dif";
            useGLLighting = "0";
            showTerrainInside = "0";
         };
         new InteriorInstance(SidebuildingA) {
            canSaveDynamicFields = "1";
            position = "-14.0984 -421.735 -0.6";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            interiorFile = "~/data/interiors/Chosen/build1.dif";
            useGLLighting = "0";
            showTerrainInside = "0";
         };
         new InteriorInstance(SideBuildingB) {
            canSaveDynamicFields = "1";
            position = "43.2404 -422.961 -0.6";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            interiorFile = "~/data/interiors/Chosen/build1.dif";
            useGLLighting = "0";
            showTerrainInside = "0";
         };
      };
      new SimGroup(gardens) {
         canSaveDynamicFields = "1";

         new TSStatic(gardenC) {
            canSaveDynamicFields = "1";
            position = "17.678 -422.242 0.066572";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/qgarden90.dts";
         };
         new TSStatic(gardenB) {
            canSaveDynamicFields = "1";
            position = "34.4099 -432.68 0.688728";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/qgarden90.dts";
         };
      };
      new SimGroup(dining) {
         canSaveDynamicFields = "1";

         new TSStatic(table1) {
            canSaveDynamicFields = "1";
            position = "12.3653 -430.032 0.231895";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/table90.dts";
         };
         new TSStatic(table2) {
            canSaveDynamicFields = "1";
            position = "22.2051 -431.992 0.174452";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/table90.dts";
         };
         new TSStatic(table4) {
            canSaveDynamicFields = "1";
            position = "28.4315 -442.362 0.0318947";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/table90.dts";
         };
         new TSStatic(table3) {
            canSaveDynamicFields = "1";
            position = "9.39801 -440.44 0.240792";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/table90.dts";
         };
         new TSStatic(seat1) {
            canSaveDynamicFields = "1";
            position = "19.5881 -430.584 -0.581211";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat2) {
            canSaveDynamicFields = "1";
            position = "26.4783 -431.721 -0.711719";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat3) {
            canSaveDynamicFields = "1";
            position = "15.8586 -429.007 -0.74168";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat4) {
            canSaveDynamicFields = "1";
            position = "9.0019 -428.259 -0.93189";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat5) {
            canSaveDynamicFields = "1";
            position = "13.1669 -440.224 -0.68085";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat6) {
            canSaveDynamicFields = "1";
            position = "5.5669 -437.224 -0.88085";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat7) {
            canSaveDynamicFields = "1";
            position = "32.6412 -441.421 -0.675407";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
         new TSStatic(seat8) {
            canSaveDynamicFields = "1";
            position = "26.6825 -441.466 -0.523602";
            rotation = "1 0 0 0";
            scale = "1 1 1";
            shapeName = "~/data/shapes/Chosen/seat90.dts";
         };
      };
   };
};
//--- OBJECT WRITE END ---

furthermore, here's the GuiEditorGui.Gui file from the Creator folder of Torque. I thought I would throw this one in, because the console log says I get a parse error in this file. From other posts, I've learned that parse errors occur when I have spaces in the names or other uncompilable characters, but I cannot find such mistakes in this file...

//----------------------------------------------------------------

new GuiControlProfile (BackFillProfile)
{
   opaque = true;
   fillColor = "0 94 94";
   border = true;
   borderColor = "255 128 128";
   fontType = "Arial";
   fontSize = 12;
   fontColor = "0 0 0";
   fontColorHL = "32 100 100";
   fixedExtent = true;
   justify = "center";
};

new GuiControl(GuiEditorGui) {
   profile = GuiDefaultProfile;
   position = "0 0";
   extent = "800 600";
   helpPage = "3. Gui Editor";
   new GuiMenuBar(GuiEditorMenuBar) {
      profile = "GuiMenuBarProfile";
      horizSizing = "width";
      vertSizing = "bottom";
      position = "0 0";
      extent = "800 22";
      minExtent = "8 8";
      visible = "1";
      helpTag = "0";
   };
   new GuiFrameSetCtrl()
   {
      position = "0 22";
      extent = "800 578";
      profile = "GuiButtonProfile";
      horizSizing = "width";
      vertSizing = "height";
      columns = "0 640";
      rows = "0";

      new GuiControl() {
         position = "0 0";
         extent = "640 578";
         minExtent = "64 64";
         horizSizing = "width";
         vertSizing = "height";
         profile = GuiDefaultProfile;
         //----------------------------------------
         // toolbar
         new GuiControl() {
            profile = "GuiWindowProfile";
            horizSizing = "width";
            vertSizing = "bottom";
            position = "0 0";
            extent = "640 28";

            new GuiControlListPopup(GuiEditorClassPopup)
            {
                  profile = "GuiEditorClassProfile";
                  position = "8 6";
                  extent = "180 16";
            };
            new GuiPopUpMenuCtrl(GuiEditorContentList)
            {
                  profile = "GuiEditorClassProfile";
                  position = "196 6";
                  extent = "180 16";
            };
            new GuiPopUpMenuCtrl(GuiEditorResList)
            {
                  profile = "GuiEditorClassProfile";
                  position = "382 6";
                  extent = "180 16";
            };
         };
         new GuiEditorRuler(GuiEditorTopRuler) {
            position = "10 28";
            extent = "630 10";
            horizSizing = "width";
            vertSizing = "bottom";
            profile = "GuiButtonProfile";
            refCtrl = GuiEditorScroll;
         };
         new GuiEditorRuler(GuiEditorLeftRuler) {
            position = "0 38";
            extent = "10 540";
            horizSizing = "right";
            vertSizing = "height";
            profile = "GuiButtonProfile";
            refCtrl = GuiEditorScroll;
         };
         new GuiScrollCtrl(GuiEditorScroll) 
         {
            profile = "GuiScrollProfile";
            position = "10 38";
            extent = "630 540";
            horizSizing = "width";
            vertSizing = "height";
            vScrollBar = "dynamic";
            hScrollBar = "dynamic";

            new GuiControl(GuiEditorRegion)
            {
               profile = "GuiDefaultProfile";
               horizSizing = "right";
               vertSizing = "bottom";
               position = "0 0";
               extent = "640 480";

               new GuiControl() // background
               {
                  profile = "BackFillProfile";
		            horizSizing = "width";
		            vertSizing = "height";
                  position = "0 0";
                  extent = "640 480";
               };
               new GuiControl(GuiEditorContent)
               {
                  profile = "GuiDefaultProfile";
		            horizSizing = "width";
		            vertSizing = "height";
                  position = "0 0";
                  extent = "640 480";
               };
               new GuiEditCtrl(GuiEditor)
               {
                  profile = "GuiTextEditProfile"; // so it's tabable
		            horizSizing = "width";
		            vertSizing = "height";
                  position = "0 0";
                  extent = "640 480";
               };
            };
         };
      };
      new GuiFrameSetCtrl()
      {
         position = "640 0";
         minExtent = "128 64";
         extent = "160 600";
         profile = "GuiButtonProfile";
         horizSizing = "width";
         vertSizing = "height";
         columns = "0";
         rows = "0 300";
         //----------------------------------------
         // Tree View
		   new GuiScrollCtrl() 
         {
            profile = "GuiScrollProfile";
			   minExtent = "72 64";
			   position = "0 0";
			   extent = "160 300";
			   horizSizing = "width";
			   vertSizing = "height";
			   vScrollBar = "alwaysOn";
			   hScrollBar = "dynamic";

			   new GuiTreeViewCtrl(GuiEditorTreeView)
            {
               profile = "GuiTreeViewProfile";
				   position = "0 0";
				   horizSizing = "width";
			   };
		   };
         //----------------------------------------
         // Inspector
         new GuiControl() { 
            profile = "GuiInspectorBackgroundProfile";
            horizSizing = "width";
            vertSizing = "height";
            position = "0 0";
            extent = "160 300";
            minExtent = "64 64";
            fillColor = "128 128 128";
         
            new GuiButtonCtrl () {
               profile = "GuiInspectorTypeFileNameProfile";
   		      position = "6 3";
   		      border = 5;
   		      extent = "40 20";
   		      text = "Apply";
   		      command = "GuiEditorInspectApply();";
   	      };

   	      new GuiTextCtrl() {
               profile = "GuiInspectorFieldProfile";
   		      position = "52 4";
   		      extent = "42 16";
   		      text = "Name:";
   	      };

   	      new GuiTextEditCtrl (GuiEditorInspectName) {
               profile = "GuiInspectorBackgroundProfile";
   		      position = "97 4";
   		      extent = "62 18";
   		      text = "";
   		      horizSizing = "width";
   		      AltCommand = "GuiEditorInspectApply();";
   		      vertSizing = "bottom";
               autoSizeWidth = false;
               autoSizeHeight = true;
               textOffset = "0 2";
   	      };

   	      new GuiScrollCtrl() {
               profile = "GuiScrollProfile";
   		      position = "0 26";
   		      extent = "160 274";
   		      horizSizing = "width";
   		      vertSizing = "height";
   		      vScrollBar = "alwaysOn";
   		      hScrollBar = "alwaysOff";

   			   new GuiInspector (GuiEditorInspectFields) {
                  useFieldGrouping = false;
                  profile = "GuiDefaultProfile";
   				   position = "0 0";
   				   extent = "140 0";
   				   horizSizing = "width";
   				   vertSizing = "bottom";
   		      };
   	      };
         };
      };

   };
};


//----------------------------------------
new GuiControl(NewGuiDialog)
{
   profile = "GuiDialogProfile";
   position = "0 0";
   extent = "640 480";
   
	new GuiWindowCtrl()
   {
      profile = "GuiWindowProfile";
		position = "220 146";
		extent = "200 188";
		text = "CreatenewGUI";
      canMove = "false";  
      canClose = "false";
      canMinimize = "false";
      canMaximize = "false";
      horizSizing = "center";
      vertSizing = "center";
      
		new GuiTextCtrl()
      {
         profile = "GuiTextProfile";
			position = "20 28";
			text = "GUI Name:";
		};
		new GuiTextEditCtrl(NewGuiDialogName)
      {
         profile = "GuiTextEditProfile";
			position = "20 44";
			extent = "160 20";
		};
		new GuiTextCtrl()
      {
         profile = "GuiTextProfile";
			position = "20 68";
			text = "Class:";
		};
		new GuiControlListPopup(NewGuiDialogClass)
      {
         profile = "GuiControlListPopupProfile";
			position = "20 84";
			extent = "160 20";
		};
		new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
			position = "56 156";
			extent = "40 16";
			text = "Create";
			command = "GuiEditorCreate();";
		};
		new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
			position = "104 156";
			extent = "40 16";
			text = "Cancel";
			command = "Canvas.popDialog(NewGuiDialog);";
		};
   };
};


//----------------------------------------
function GuiEditorStartCreate()
{
   NewGuiDialogClass.setText("GuiControl");
   NewGuiDialogClass.sort();
   NewGuiDialogName.setValue("NewGui");
   Canvas.pushDialog(NewGuiDialog);
}

//----------------------------------------
function GuiEditorCreate()
{
   %name = NewGuiDialogName.getValue();
   %class = NewGuiDialogClass.getText();
   Canvas.popDialog(NewGuiDialog);
   %obj = eval("return new " @ %class @ "(" @ %name @ ");");
   GuiEditorOpen(%obj);
}

//----------------------------------------
function GuiEditorSaveGui()
{
   %obj = GuiEditorContent.getObject(0);
   if(%obj == -1 || %obj.getName() $= "")
      return;
   %name = %obj.getName() @ ".gui";
   if ($BlockSave!=1) {
      getSaveFilename("*.gui", "GuiEditorSaveGuiCallback", %name);
   } else {
      echo("To enable gui saving, make $BlockSave=1.");
      MessageBoxOK("Save Function Disabled","The Save GUI function has been disabled for this demo walkthrough.\n\n  If you are sure you want to make permanent GUI changes, go to the console (tilde \"~\" key) and type \"$BlockSave=0;\" first.");
   }
}

function GuiEditorSaveGuiCallback(%name)
{
   %obj = GuiEditorContent.getObject(0);
   
   // make sure it is saved...
   if(!%obj.save(%name))
   {
      MessageBoxOK("GuiEditor Save Failure", "Failed to save '" @ %name @ "'. The file may be read-only.");
   }
}   

//----------------------------------------
function GuiEdit(%val)
{
   if(%val != 0)
      return;
      
   %content = Canvas.getContent();
   
   if(%content == GuiEditorGui.getId())
   {
      //GlobalActionMap.bind(mouse, button1, mouselook);

      %obj = GuiEditorContent.getObject(0);
      if(%obj != -1)
      {
         GuiGroup.add(%obj);
         //Canvas.setContent(%obj);
         Canvas.setContent($previousContent);
      }
      echo("Exporting Gui Editor Prefs");
      export( "$Pref::GuiEditor::*", "./prefs.cs", false );
      GlobalActionMap.unbind( keyboard, "delete" );
   }
   else
   {
      $previousContent = %content;
      exec("./prefs.cs");
      //GlobalActionMap.unbind(mouse, button1);
      GuiEditorOpen(%content);
   }
}

package GuiEditor_BlockDialogs
{

function GuiCanvas::pushDialog()
{

}

function GuiCanvas::popDialog()
{

}

};

//----------------------------------------
function GuiEditorOpen(%content)
{
   GuiEditorMenuBar.clearMenus();
   GuiEditorMenuBar.addMenu("File", 0);
   GuiEditorMenuBar.addMenuItem("File", "New GUI...", 1);
   GuiEditorMenuBar.scriptCommand["File", 1] = "GuiEditorStartCreate();";
   GuiEditorMenuBar.addMenuItem("File", "Save GUI...", 2);
   GuiEditorMenuBar.scriptCommand["File", 2] = "GuiEditorSaveGui();";
   GuiEditorMenuBar.addMenuItem("File", "-", 0);
   GuiEditorMenuBar.addMenuItem("File", "GUI Editor Help...", 3, "F1");
   GuiEditorMenuBar.scriptCommand["File", 3] = "getHelp(\"5. Gui Editor\");";
   GuiEditorMenuBar.addMenuItem("File", "Toggle GUI Editor...", 4, "F10");
   GuiEditorMenuBar.scriptCommand["File", 4] = "GuiEdit(0);";

   GuiEditorMenuBar.addMenu("Edit", 1);
   GuiEditorMenuBar.addMenuItem("Edit", "Cut", 3, "Ctrl X");
   GuiEditorMenuBar.scriptCommand["Edit", 3] = "GuiEditor.saveSelection($GUI::clipboardFile); GuiEditor.deleteSelection();";
   GuiEditorMenuBar.setMenuItemBitmap("Edit", "Cut", 3);
   GuiEditorMenuBar.addMenuItem("Edit", "Copy", 4, "Ctrl C");
   GuiEditorMenuBar.scriptCommand["Edit", 4] = "GuiEditor.saveSelection($GUI::clipboardFile);";
   GuiEditorMenuBar.setMenuItemBitmap("Edit", "Copy", 4);
   GuiEditorMenuBar.addMenuItem("Edit", "Paste", 5, "Ctrl V");
   GuiEditorMenuBar.scriptCommand["Edit", 5] = "GuiEditor.loadSelection($GUI::clipboardFile);";
   GuiEditorMenuBar.setMenuItemBitmap("Edit", "Paste", 5);
   GuiEditorMenuBar.addMenuItem("Edit", "-", 0);
   GuiEditorMenuBar.addMenuItem("Edit", "Select All", 6, "Ctrl A");
   GuiEditorMenuBar.scriptCommand["Edit", 6] = "GuiEditor.selectAll();";

   GuiEditorMenuBar.addMenu("Layout", 2);
   GuiEditorMenuBar.addMenuItem("Layout", "Align Left", 1, "Ctrl L");
   GuiEditorMenuBar.scriptCommand["Layout", 1] = "GuiEditor.Justify(0);";
   GuiEditorMenuBar.addMenuItem("Layout", "Align Right", 2, "Ctrl R");
   GuiEditorMenuBar.scriptCommand["Layout", 2] = "GuiEditor.Justify(2);";
   GuiEditorMenuBar.addMenuItem("Layout", "Align Top", 3, "Ctrl T");
   GuiEditorMenuBar.scriptCommand["Layout", 3] = "GuiEditor.Justify(3);";
   GuiEditorMenuBar.addMenuItem("Layout", "Align Bottom", 4, "Ctrl B");
   GuiEditorMenuBar.scriptCommand["Layout", 4] = "GuiEditor.Justify(4);";
   GuiEditorMenuBar.addMenuItem("Layout", "-", 0);
   GuiEditorMenuBar.addMenuItem("Layout", "Center Horizontally", 5);
   GuiEditorMenuBar.scriptCommand["Layout", 5] = "GuiEditor.Justify(1);";
   GuiEditorMenuBar.addMenuItem("Layout", "Space Vertically", 6);
   GuiEditorMenuBar.scriptCommand["Layout", 6] = "GuiEditor.Justify(5);";
   GuiEditorMenuBar.addMenuItem("Layout", "Space Horizontally", 7);
   GuiEditorMenuBar.scriptCommand["Layout", 7] = "GuiEditor.Justify(6);";
   GuiEditorMenuBar.addMenuItem("Layout", "-", 0);
   GuiEditorMenuBar.addMenuItem("Layout", "Bring to Front", 8);
   GuiEditorMenuBar.scriptCommand["Layout", 8] = "GuiEditor.BringToFront();";
   GuiEditorMenuBar.addMenuItem("Layout", "Send to Back", 9);
   GuiEditorMenuBar.scriptCommand["Layout", 9] = "GuiEditor.PushToBack();";
   GuiEditorMenuBar.addMenuItem("Layout", "Lock Selection", 10);
   GuiEditorMenuBar.scriptCommand["Layout",10] = "GuiEditorTreeView.lockSelection(true);";
   GuiEditorMenuBar.addMenuItem("Layout", "Unlock Selection", 11);
   GuiEditorMenuBar.scriptCommand["Layout",11] = "GuiEditorTreeView.lockSelection(false);";
   GuiEditorMenuBar.addMenu("Move", 3);
   GuiEditorMenuBar.addMenuItem("Move", "Nudge Left", 1, "Left");
   GuiEditorMenuBar.scriptCommand["Move", 1] = "GuiEditor.moveSelection(-1,0);";
   GuiEditorMenuBar.addMenuItem("Move", "Nudge Right", 2, "Right");
   GuiEditorMenuBar.scriptCommand["Move", 2] = "GuiEditor.moveSelection(1,0);";
   GuiEditorMenuBar.addMenuItem("Move", "Nudge Up", 3, "Up");
   GuiEditorMenuBar.scriptCommand["Move", 3] = "GuiEditor.moveSelection(0,-1);";
   GuiEditorMenuBar.addMenuItem("Move", "Nudge Down", 4, "Down");
   GuiEditorMenuBar.scriptCommand["Move", 4] = "GuiEditor.moveSelection(0,1);";
   GuiEditorMenuBar.addMenuItem("Move", "-", 0);
   GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Left", 5, "Shift Left");
   GuiEditorMenuBar.scriptCommand["Move", 5] = "GuiEditor.moveSelection(-10,0);";
   GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Right", 6, "Shift Right");
   GuiEditorMenuBar.scriptCommand["Move", 6] = "GuiEditor.moveSelection(10,0);";
   GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Up", 7, "Shift Up");
   GuiEditorMenuBar.scriptCommand["Move", 7] = "GuiEditor.moveSelection(0,-10);";
   GuiEditorMenuBar.addMenuItem("Move", "Big Nudge Down", 8, "Shift Down");
   GuiEditorMenuBar.scriptCommand["Move", 8] = "GuiEditor.moveSelection(0,10);";


   Canvas.setContent(GuiEditorGui);
   while((%obj = GuiEditorContent.getObject(0)) != -1)
      GuiGroup.add(%obj); // get rid of anything being edited

   %i = 0;
   GuiEditorContentList.clear();
   while((%obj = GuiGroup.getObject(%i)) != -1)
   {
      if(%obj.getName() !$= Canvas)
      {
         if(%obj.getName() $= "")
            %name = "(unnamed) - " @ %obj;
         else
            %name = %obj.getName() @ " - " @ %obj;

         GuiEditorContentList.add(%name, %obj);
      }
      %i++;
   
      activatePackage(GuiEditor_BlockDialogs);
      GuiEditorContent.add(%content);
      deactivatePackage(GuiEditor_BlockDialogs);
      GuiEditorContentList.sort();
   }
   
   GuiEditorClassPopup.sort();
   GuiEditorResList.clear();
   GuiEditorResList.add("640 x 480", 640);
   GuiEditorResList.add("800 x 600", 800);
   GuiEditorResList.add("1024 x 768", 1024);
   %ext = $Pref::GuiEditor::PreviewResolution;
   if( %ext $= "" )
   {
   %ext = GuiEditorRegion.getExtent();
   echo("extent is " @ %ext );
   switch(getWord(%ext, 0))
   {
      case 640:
         GuiEditorResList.setText("640 x 480");
      case 800:
         GuiEditorResList.setText("800 x 600");
      case 1024:
         GuiEditorResList.setText("1024 x 768");
   }
   }
   else
   {
      GuiEditorResList.setText( getWord(%ext,0) @ " x " @ getWord(%ext, 1) );
   }
   if(%content.getName() $= "")
      %name = "(unnamed) - " @ %content;
   else
      %name = %content.getName() @ " - " @ %content;
   
   GuiEditorContentList.setText(%name);
   GuiEditorClassPopup.setText("New Control");
   GuiEditor.setRoot(%content);
   GuiEditorRegion.resize(0,0,getWord(%ext,0), getWord(%ext, 1));
   GuiEditorContent.getObject(0).resize(0,0,getWord(%ext,0), getWord(%ext, 1));

//   %content.resize(0,0,getWord(%ext,0), getWord(%ext, 1));

   GuiEditorTreeView.open(%content);

}

function GuiEditorMenuBar::onMenuItemSelect(%this, %menuId, %menu, %itemId, %item)
{
   if(%this.scriptCommand[%menu, %itemId] !$= "")
      eval(%this.scriptCommand[%menu, %itemId]);
   else
      error("No script command defined for menu " @ %menu  @ " item " @ %item);
}

//----------------------------------------
function GuiEditorContentList::onSelect(%this, %id)
{
   GuiEditorOpen(%id);
}

//----------------------------------------
function GuiEditorClassPopup::onSelect(%this, %id)
{
   %class = %this.getText();
   %obj = eval("return new " @ %class @ "();");
   GuiEditor.addNewCtrl(%obj);
   GuiEditorClassPopup.setText("New Control");
}

function GuiEditorResList::onSelect(%this, %id)
{
   switch(%id)
   {
      case 640:
         GuiEditorRegion.resize(0,0,640,480);
         GuiEditorContent.getObject(0).resize(0,0,640,480);
         $Pref::GuiEditor::PreviewResolution = "640 480";
      case 800:
         GuiEditorRegion.resize(0,0,800,600);
         GuiEditorContent.getObject(0).resize(0,0,800,600);
         $Pref::GuiEditor::PreviewResolution = "800 600";
      case 1024:
         GuiEditorRegion.resize(0,0,1024,768);
         GuiEditorContent.getObject(0).resize(0,0,1024,768);
         $Pref::GuiEditor::PreviewResolution = "1024 768";
   }
}

//----------------------------------------
// defines the icons to be used in the tree view control
// provide the paths to each icon minus the file extension
// seperate them with : 
// the order of the icons must correspond to the bit array defined
// in the GuiTreeViewCtrl.h
function GuiEditorTreeView::onDefineIcons(%this)
{
   //%icons = "common/ui/shll_icon_passworded_hi:common/ui/shll_icon_passworded:common/ui/shll_icon_notqueried_hi:common/ui/shll_icon_notqueried:common/ui/shll_icon_favorite_hi:common/ui/shll_icon_default:";
   //GuiEditorTreeView.buildIconTable(%icons);
}

function GuiEditorTreeView::onRightMouseDown(%this, %item, %pts, %obj)
{
   if(%obj)
   {
      GuiEditor.setCurrentAddSet(%obj);
   }
}

function GuiEditorTreeView::onAddSelection(%this,%ctrl)
{
   GuiEditor.addSelection(%ctrl);
}

function GuiEditorTreeView::onRemoveSelection(%this,%ctrl)
{
   GuiEditorTreeView.removeSelection(%ctrl);
}

function GuiEditor::onClearSelected(%this)
{ 
   GuiEditorTreeView.clearSelection();
}

function GuiEditor::onAddSelected(%this,%ctrl)
{
   GuiEditorTreeView.addSelection(%ctrl);
}

function GuiEditor::onRemoveSelected(%this,%ctrl)
{
   GuiEditorTreeView.removeSelection(%ctrl); 
}

function GuiEditor::onDelete(%this)
{
   GuiEditorTreeView.deleteSelection();
}

function GuiEditorTreeView::onDeleteSelection(%this)
{ 
   GuiEditor.clearSelection();
}

function GuiEditorTreeView::onSelect(%this, %obj)
{
   if(isObject(%obj))
   {
      GuiEditorInspectFields.inspect(%obj);
      GuiEditorInspectName.setValue(%obj.getName());
      GuiEditor.select(%obj);
   }
}

//----------------------------------------
function GuiEditorInspectApply()
{
   GuiEditorInspectFields.setName(GuiEditorInspectName.getValue());
}

//----------------------------------------
function GuiEditor::onSelect(%this, %ctrl)
{  
   GuiEditorInspectFields.inspect(%ctrl);
   GuiEditorInspectName.setValue(%ctrl.getName());
   GuiEditor.clearSelection();
   GuiEditor.select(%ctrl);
   GuiEditorTreeView.addSelection(%ctrl); 
}

//----------------------------------------
//function GuiEditorDeleteSelected( %val ) {
//  if( %val )
//    GuiEditor.deleteSelection();
//}      

GlobalActionMap.bind(keyboard, "f10", GuiEdit);

and lastly, the console.log file itself...

//-------------------------- 11/18/2009 -- 00:03:32 -----
Processor Init:
   Intel (unknown, Pentium Pro/II/III family), ~1.70 Ghz
     (timed at roughly 1.69 Ghz)
   FPU detected
   MMX detected
   SSE detected
 
Math Init:
   Installing Standard C extensions
   Installing Assembly extensions
   Installing FPU extensions
   Installing MMX extensions
   Installing SSE extensions
 
Input Init:
   keyboard0 input device created.
   mouse0 input device created.
   DirectInput enabled.

Initializing chunk mappings...
   o 'TEXT' maps to TextChunk
   o 'SCHK' maps to UnknownChunk
   o 'SCHK' maps to SimChunk
--------- Loading MODS ---------
Loading compiled script TheChosen/main.cs.
Loading compiled script common/main.cs.
Loading compiled script TheChosen/client/defaults.cs.
Loading compiled script TheChosen/server/defaults.cs.
Compiling TheChosen/prefs.cs...
Loading compiled script TheChosen/prefs.cs.
Loading compiled script creator/main.cs.
Loading compiled script common/main.cs.

--------- Parsing Arguments ---------

--------- Initializing MOD: Common ---------
Loading compiled script common/client/canvas.cs.
Loading compiled script common/client/audio.cs.

--------- Initializing TTB: Server ---------
Loading compiled script common/server/audio.cs.
Loading compiled script common/server/server.cs.
Loading compiled script common/server/message.cs.
Loading compiled script common/server/commands.cs.
Loading compiled script common/server/missionInfo.cs.
Loading compiled script common/server/missionLoad.cs.
Loading compiled script common/server/missionDownload.cs.
Loading compiled script common/server/clientConnection.cs.
Loading compiled script common/server/kickban.cs.
Loading compiled script common/server/game.cs.
Loading compiled script TheChosen/server/game.cs.

--------- Initializing TTB: Client ---------
Loading compiled script common/client/message.cs.
Loading compiled script common/client/mission.cs.
Loading compiled script common/client/missionDownload.cs.
Loading compiled script common/client/actionMap.cs.
Video Init:
   Accelerated OpenGL display device detected.
   Accelerated D3D device detected.
   Voodoo 2 display device not detected.

Activating the D3D display device...
Setting screen mode to 800x600x32 (w)...
Creating a new window...
Acquiring a new device context...
Pixel format set:
  32 color bits, 32 depth bits, 0 stencil bits
Creating a new rendering context...
Making the new rendering context current...
OpenGL driver information:
  Vendor: Microsoft Corp.
  Renderer: Direct3D
  Version: 1.1
OpenGL Init: Enabled Extensions
  ARB_multitexture (Max Texture Units: 2)
  EXT_compiled_vertex_array
  EXT_texture_env_combine
  EXT_fog_coord
OpenGL Init: Disabled Extensions
  EXT_blend_color
  EXT_blend_minmax
  EXT_paletted_texture
  NV_vertex_array_range
  EXT_packed_pixels
  ARB_texture_compression
  EXT_texture_compression_s3tc
  3DFX_texture_compression_FXT1
  (ARB|EXT)_texture_env_add
  EXT_texture_filter_anisotropic
  WGL_EXT_swap_control

Loading compiled script common/ui/defaultProfiles.cs.
Loading compiled script common/ui/ConsoleDlg.gui.
Loading compiled script common/ui/LoadFileDlg.gui.
Loading compiled script common/ui/ColorPickerDlg.gui.
Loading compiled script common/ui/SaveFileDlg.gui.
Loading compiled script common/ui/MessageBoxOkDlg.gui.
Loading compiled script common/ui/MessageBoxYesNoDlg.gui.
Loading compiled script common/ui/MessageBoxOKCancelDlg.gui.
Loading compiled script common/ui/MessagePopupDlg.gui.
Loading compiled script common/ui/HelpDlg.gui.
Loading compiled script common/ui/RecordingsDlg.gui.
Loading compiled script common/ui/NetGraphGui.gui.
Loading compiled script common/client/metrics.cs.
Loading compiled script common/ui/FrameOverlayGui.gui.
Loading compiled script common/client/messageBox.cs.
Loading compiled script common/client/screenshot.cs.
Loading compiled script common/client/cursor.cs.
Loading compiled script common/client/help.cs.
Loading compiled script common/client/recordings.cs.

OpenAL Driver Init:
OpenAL
   Vendor: Creative Labs Inc.
   Version: 1.1
   Renderer: Software
   Extensions: EAX EAX2.0 EAX3.0 EAX4.0 EAX5.0 EAX3.0EMULATED EAX4.0EMULATED AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE

Loading compiled script TheChosen/client/audioProfiles.cs.
Loading compiled script TheChosen/client/ui/PlayGui.gui.
Loading compiled script TheChosen/client/ui/mainMenuGui.gui.
Missing file: TheChosen/client/ui/optionsDlg.gui!
Loading compiled script TheChosen/client/ui/loadingGui.gui.
Loading compiled script TheChosen/client/optionsDlg.cs.
Loading compiled script TheChosen/client/missionDownload.cs.
Loading compiled script TheChosen/client/serverConnection.cs.
Loading compiled script TheChosen/client/loadingGui.cs.
Loading compiled script TheChosen/client/playGui.cs.
Missing file: TheChosen/client/clientGame.cs!
Loading compiled script TheChosen/client/default.bind.cs.

--------- Initializing: Torque Creator ---------
Loading compiled script creator/editor/editor.cs.
Loading compiled script creator/editor/particleEditor.cs.
Loading compiled script creator/scripts/scriptDoc.cs.
Loading compiled script creator/ui/creatorProfiles.cs.
Loading compiled script creator/ui/InspectDlg.gui.
Compiling creator/ui/GuiEditorGui.gui...
Loading compiled script creator/ui/GuiEditorGui.gui.
Engine initialized...
parse error
   keyboard0 input device created.
   mouse0 input device created.
   keyboard0 input device created.
   mouse0 input device created.
Exporting prefs
Exporting client prefs
Exporting server prefs


I appreciate any help you guys can give!

#1
11/21/2009 (1:55 pm)
Just skimming through the console log and I'd take a look at hese errors:
"Missing file: TheChosen/client/ui/optionsDlg.gui!"
"Missing file: TheChosen/client/clientGame.cs!"

Also for the parse error your very first gui component is written like this:
"new GuiControlProfile (BackFillProfile)"
I'm not sure but it may not like that space between the component and namespace.

Also if it is the commandbutton itself that will not properly load the mission check your button's syntax.

I'm not sure what else to tell you but hopefully that helps.
#2
11/26/2009 (7:20 pm)
@CSMP,

As for the missing files, Options.dlg I have no answer for.
The other one clientGame.cs, assuming it is the main game file I have not written yet!

As for the parse error, I corrected the problem you mentioned plus several others i found in the file, but the parse error still occurs!

For the other suggestions, I followed them. I checked the syntax in the command line, made sure it (loadMyMission()) matched the command in the main.cs file. it still does not work!

Any help would be appreciated!
#3
11/27/2009 (8:40 pm)
The parse error is not necessarily happening on the GuiEditorGui -- you can see it happens after the Engine initialized...

I'd suggest you add a quick debug print statement at the beginning of the evaluate function in console/console.cc -- it'll be a little spammy, but will at least help you figure out where the parse error is happening.

i.e.
const char *evaluate(const char* string, bool echo, const char *fileName)
{
  Con::errorf("Evaluating %s",string);
  ...
}

And if that doesn't lead you to the problem, it still might be helpful to post your "Simple Main GUI". A second set of eyes may still help.
#4
11/27/2009 (11:04 pm)
Thx Mr. Greenheigh

I've done as you said. Either I'm doing it wrong, or I don't know what I'm doing, because it doesn't work!

Anyway, here's a posting of my MainMenuGui.cs file!

//--- OBJECT WRITE BEGIN ---
new GuiChunkedBitmapCtrl(MainMenuGui) {
   canSaveDynamicFields = "0";
   Profile = "GuiContentProfile";
   HorizSizing = "width";
   VertSizing = "height";
   position = "0 0";
   Extent = "640 480";
   MinExtent = "8 8";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";
   bitmap = "./title300.bmp";
   useVariable = "0";
   tile = "0";

   new GuiButtonCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiButtonProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      position = "428 232";
      Extent = "140 32";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      text = "play";
      groupNum = "-1";
      buttonType = "PushButton";
   };
   new GuiButtonCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiButtonProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      position = "427 272";
      Extent = "142 32";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      text = "load";
      groupNum = "-1";
      buttonType = "PushButton";
   };
   new GuiButtonCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiButtonProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      position = "429 313";
      Extent = "139 34";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      Command = "loadMyMission()";
      hovertime = "1000";
      text = "create";
      groupNum = "-1";
      buttonType = "PushButton";
   };
   new GuiButtonCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiButtonProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      position = "428 356";
      Extent = "140 32";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      Command = "quit()";
      hovertime = "1000";
      text = "quit";
      groupNum = "-1";
      buttonType = "PushButton";
   };
};
//--- OBJECT WRITE END ---
#5
11/27/2009 (11:08 pm)
Part II.
This is continued from the last post as the GarageGames system would not let me post replies over 1000 characters!

The most imported part of the updated console log

--------- Initializing: Torque Creator ---------
Loading compiled script creator/editor/editor.cs.
Loading compiled script creator/editor/particleEditor.cs.
Loading compiled script creator/scripts/scriptDoc.cs.
Loading compiled script creator/ui/creatorProfiles.cs.
Loading compiled script creator/ui/InspectDlg.gui.
Loading compiled script creator/ui/GuiEditorGui.gui.
Engine initialized...
parse error
parse error
parse error
Exporting prefs
Exporting client prefs
Exporting server prefs

Yea..., the parse error occurs three times because I pressed the ~ button three times!

#6
11/27/2009 (11:28 pm)
Ah, so that's why your parse error happens, your problem is you're missing the semi-colon after the loadMyMission()

It should be:

Command = "loadMyMission();";

Note the semi-colon before the closing quotes.
#7
11/27/2009 (11:52 pm)
Thanks james,

Would this be the case for all commands then?
#8
11/27/2009 (11:55 pm)
Yes. As an added note it can be more then one command, hence why they semi-colon is particularly important. So you could have Command = "loadMyMission();playStartingMusic();" for example