Gui Commands (start mission command)
by Darin Pitts · in Torque Game Engine · 03/26/2008 (7:58 pm) · 4 replies
Hi everyone,
Quick question,
I'm looking for a command that will start a specific mission by the push of a button.
I'm rather new at this so used what i could from the example gui system. The problem is that gui system uses a list and you lanch the mision with the command SM_StartMission(); i tried several things to have a button start a particular mission.
SM_startMission(\starter.fps\data\missions\lobby.mis);
StartMission(\starter.fps\data\missions\lobby.mis);
SM_StartMission(lobby.mis);
can any one tell me what im doing wrong? Is there a diffrent command to start a particular mission?
Any help would be awsome
Thanks
Quick question,
I'm looking for a command that will start a specific mission by the push of a button.
I'm rather new at this so used what i could from the example gui system. The problem is that gui system uses a list and you lanch the mision with the command SM_StartMission(); i tried several things to have a button start a particular mission.
SM_startMission(\starter.fps\data\missions\lobby.mis);
StartMission(\starter.fps\data\missions\lobby.mis);
SM_StartMission(lobby.mis);
can any one tell me what im doing wrong? Is there a diffrent command to start a particular mission?
Any help would be awsome
Thanks
#2
03/26/2008 (8:38 pm)
Cool i'll look it up.
#3
The good news was we were able to look as some of those scripts and build something similar that did every thing we wanted
Now we have a button that goes to a specific mission, starts a multilayer server and sets max players on the server. The great thing is we have variables set to this function so we can make diffrent buttons point to diffrent missions and different server maxs.
To do this we wrote a function into the Gui file itself. Here is the code for any one else interested in doing something similar but doesn't know where to start
//----------------------------------------
function LdMission(%mission, $numPlayers)
{
// %id = SM_missionList.getSelectedId();
// %mission = getField(SM_missionList.getRowTextById(%id), 1);
$Pref::Server::MaxPlayers = $numPlayers;
echo("\n--------- Maximum number of players set to:");
echo($Pref::Server::MaxPlayers);
if ($numPlayers > 1)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
createServer(%serverType, %mission);
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
// %conn.setConnectArgs($pref::Player::Name);
// %conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}
Hope this helps others
04/10/2008 (9:56 am)
Unfortunately the answer was not in the tutorial. It had a similar process that we eventually used but it was not what we neededThe good news was we were able to look as some of those scripts and build something similar that did every thing we wanted
Now we have a button that goes to a specific mission, starts a multilayer server and sets max players on the server. The great thing is we have variables set to this function so we can make diffrent buttons point to diffrent missions and different server maxs.
To do this we wrote a function into the Gui file itself. Here is the code for any one else interested in doing something similar but doesn't know where to start
//----------------------------------------
function LdMission(%mission, $numPlayers)
{
// %id = SM_missionList.getSelectedId();
// %mission = getField(SM_missionList.getRowTextById(%id), 1);
$Pref::Server::MaxPlayers = $numPlayers;
echo("\n--------- Maximum number of players set to:");
echo($Pref::Server::MaxPlayers);
if ($numPlayers > 1)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
createServer(%serverType, %mission);
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
// %conn.setConnectArgs($pref::Player::Name);
// %conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}
Hope this helps others
#4
Then have your button use the command loadDefaultMissing();
04/10/2008 (2:11 pm)
One way of doing this for single player games is as follows. (Do this on the client side)function loadDefaultMission()
{
Canvas.setCursor("DefaultCursor");
createServer( "SinglePlayer", expandFileName("~/data/missions/simple.mis") );
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}Then have your button use the command loadDefaultMissing();
Torque Owner Robert \"Roswell_r\"