Game Development Community

A short GUI question :-).

by Jan Sorensen · in General Discussion · 05/15/2008 (1:29 pm) · 2 replies

Hi there a short question :-).

Normally I use this command in my GUI when I call a server, works fine:
command = "connect(\"80.106.315.17:27031\");";

But please tell me. If I shall call a local MIS file on my computer, what is the command ?? I have trying many things without luck :-(.

The IP is a "dummy address" :-D.

Jan :-).

#1
05/16/2008 (9:04 am)
Hi again :-).

Here is the solution. A separate "load and start" function in a CS file call from the menu GUI bottom.
"EXEC" from fps/client/script.

// Opret en lokal missionsserver

function SM_StartMission()
{
%id = SM_missionList.getSelectedId();
%mission = "fps/data/missions/Start.mis";

if ($pref::HostMultiPlayer)
%serverType = "MultiPlayer";

else
%serverType = "SinglePlayer";

createServer(%serverType, %mission);
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($LicenseInfo::Username, $pref::Player::PlayerData, $LicenseInfo::Email, $LicenseInfo::PlayerType, $LicenseInfo::ValidMonth, $LicenseInfo::SerialNumber);
%conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}

Thanks Jan :-).
#2
05/17/2008 (12:30 am)
The complete solution for a new "Start" GUI bottom:

A new "Local .mis start" function place somewhere, maybe in a new .cs file ?

// Opret server og kald lokal mission..
function LokalMission (%mission)
{
createServer("SinglePlayer", %mission);

%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($your player);
%conn.setJoinPassword($Client::Password);
%conn.connectLocal();
}


The new "Start" bottom in the GUI menu...

new GuiBitmapButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "22 150";
extent = "105 30";
minExtent = "8 8";
visible = "1";
command = "LokalMission(\"fps/data/missions/Start.mis\");";
text = "Start";
groupNum = "-1";
buttonType = "PushButton";
helpTag = "0";
};

If you make a new .cs file, remember:
exec("./scripts/your_new.cs"); in "fps/client/init.cs".

Jan :-).