Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   How to get mission file name? (http://forum.fulqrumpublishing.com/showthread.php?t=36180)

salmo 11-24-2012 01:31 PM

How to get mission file name?
 
How to get mission file name by script please?

hc_wolf 11-25-2012 04:47 AM

Quote:

Originally Posted by salmo (Post 483569)
How to get mission file name by script please?

A sub mission file name that you are loading or the main mission file that is running from start?

salmo 11-25-2012 07:34 AM

Quote:

Originally Posted by hc_wolf (Post 483684)
A sub mission file name that you are loading or the main mission file that is running from start?

Get the main mission file that is running from start while it's running.

theOden 11-25-2012 06:56 PM

This is how I do in my BoB5 campaign:

Quote:


if (GamePlay is GameServerDef)
{
GameServerDef gameServer = (GameServerDef)GamePlay;
ISectionFile missFile = gameServer.game.FirstMissionFile();
//int n = missFile.lines("FrontMarker");
//GamePlay.gpHUDLogCenter("FrontMarker " +n.ToString());
readMission(missFile);
};
if (GamePlay is GameSingleDef)
{
GameSingleDef gameServer = (GameSingleDef)GamePlay;
ISectionFile missFile = gameServer.game.FirstMissionFile();
//int n = missFile.lines("FrontMarker");
//GamePlay.gpHUDLogCenter("FrontMarker " + n.ToString());
readMission(missFile);
};


Edit: you might need this reference above public class Mission: [//$reference parts\core\gamePlay.dll]
Download and copypaste whatever if it helps: download

hc_wolf 11-26-2012 09:34 AM

Another easy way is just set a const string and ref that when you need to. This works if you have a .cs for that mission.

theOden 11-26-2012 02:45 PM

Used to do that but it forces you to predict where the user will copy/install your missionfile.
Instructions aren't often read nowadays.
This other way is more solid.

salmo 11-27-2012 02:42 AM

Thankyou Oden. I've tried pasting the code below into the OnBattleStart. It gives errors & I can't figure out how to reference the gamePlay.dll even when I look at your examples.

Code:

if (GamePlay is GameServerDef)
{
GameServerDef gameServer = (GameServerDef)GamePlay;
ISectionFile missFile = gameServer.game.FirstMissionFile();
//int n = missFile.lines("FrontMarker");
//GamePlay.gpHUDLogCenter("FrontMarker " +n.ToString());
readMission(missFile);
};
if (GamePlay is GameSingleDef)
{
GameSingleDef gameServer = (GameSingleDef)GamePlay;
ISectionFile missFile = gameServer.game.FirstMissionFile();
//int n = missFile.lines("FrontMarker");
//GamePlay.gpHUDLogCenter("FrontMarker " + n.ToString());
readMission(missFile);
};


theOden 11-27-2012 07:12 AM

Hmm, weird.
You do add the reference with double slash (looks like commented out to me)?

No idea what could be wrong. :(

moggel 12-04-2012 03:08 PM

theOden,

I've been looking for a solution to get the (main) mission file too. I get an error message informing me the object implementing the "ISectionFile" interface is not marked as serializable (the error is thrown when invoking "ISectionFile missFile = gameServer.game.FirstMissionFile();").
Seems it can't be remoted from the sim AppDomain ...

Would you mind sending the whole .cs file?


All times are GMT. The time now is 08:24 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.