PDA

View Full Version : How to get mission file name?


salmo
11-24-2012, 01:31 PM
How to get mission file name by script please?

hc_wolf
11-25-2012, 04:47 AM
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
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:



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 (http://odenhouse.servegame.com/bob5.7z)

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.


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?