Game Development Community

Mission Loading: what am I doing wrong?

by Rodney (OldRod) Burns · in Torque Game Engine · 11/14/2003 (6:36 pm) · 2 replies

I'm attempting to jump directly into a mission file when a button is pushed, rather than selecting the mission from a list. In another thread (over in the public area) was an example, but I can't seem to get it to work.

In my mainmenu.gui I have the following:

new GuiButtonCtrl() {
      profile = "GuiButtonProfile";
      horizSizing = "relative";
      vertSizing = "relative";
      position = "260 395";
      extent = "110 20";
      minExtent = "8 8";
      visible = "1";
      command = "StartMission();";
      text = "Enter the World";
      groupNum = "-1";
      buttonType = "PushButton";
         helpTag = "0";
   };

Then, at the end of mainmenu.gui I have:

function StartMission()
{
   Canvas.setContent(loadingGui);
   LOAD_MapName.setText( "Creating Server" );      
   
   if ($pref::HostMultiPlayer)
      %serverType = "MultiPlayer";
   else
      %serverType = "SinglePlayer";

   createServer(%serverType, "starter.fps/data/missions/develop.mis");
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs($pref::Player::Name);
   %conn.setJoinPassword($Client::Password);
   %conn.connectLocal();
}

When I click the button, I get the loadingGui screen, but all it has is a "Cancel" button and a blank progress bar. It does nothing else and I have to click "Cancel" to return to the menu.

I'm sure I'm missing something obvious, but I just can't see it. Can anyone help? :)

#1
11/15/2003 (5:05 am)
You don't have to set the loadingGui manually, remove that line, it will be placed automatically. Other than that make sure the path to the mission is correct.
#2
11/15/2003 (1:13 pm)
That was the problem. I removed the Canvas.setContent statement and it works now. Thanks :)