Results 1 to 22 of 22

Thread: Command line switches

  1. #1
    Member Member
    Join Date
    Apr 2006
    Posts
    47

    Default Config File & .cfg Switching

    The config file

    The medieval2.preference.cfg file that you can find in your M2TW directory has a lot of settings that can be used to enhance modding or customize your game.
    The primary uses for it in modding are presumably as a mod switcher (together with a .bat file, explained later), to enable the battle editor, and to set error tracking, but there are some further options that you can enable.
    Please note: The following code snippets should be inserted into your .cfg file. If two snippets belong to the same section (sections headers are the words in square brackets), the second section header can (and should) be omitted.

    This file should not actually be modified, because according to wilddog the game will overwrite it again. To create a permanent custom configuration, follow the instructions mentioned below under ".cfg Switching".


    Bug Tracking

    To enable the error logging functions of MTW2, add:
    Code:
    [log]
    to          = logs/system.log.txt
    level       = * error
    The following gives a lot of info that won't be very useful for the average modder, but if the error logging doesn't help you, try it:
    Code:
    [log]
    to          = logs/system.log.txt
    level       = * trace
    You can further use both level statements in the same file in which case the last setting will be used. As an example, providing:
    Code:
    [log]
    to          = logs/system.log.txt
    level       = * trace
    level       = * error
    Will do the same as if you only supplied level = * error.


    Battle Editor

    To enable the battle editor, simply add these two lines:
    Code:
    [features]
    editor = true
    Faction Unlocking

    These few lines will unlock all playable factions in your campaign:
    Code:
    [misc]
    unlock_campaign = true

    Running in a Window

    To run the game in a window (same as the "-ne" switch in RTW), add:
    Code:
    [video]
    windowed = true

    Disabling the Videos

    If you want to disable the movies for the game ("-nm" switch in RTW), use:
    Code:
    [video]
    movies = false


    .cfg Switching

    The .cfg switching mechanism allows you to use different game configuration.
    To start the game using a different config file, you have to create a new batch file (create a new text file and rename the file extension to .bat) in your MTW2 directory, that looks like this:
    Code:
    medieval2.exe @mod.cfg
    Then create a copy of your medieval2.preference.cfg, rename it to mod.cfg (you can use any name here, just remember to also change it in the .bat file) and make your changes. Then create a shortcut to your newly-created .bat file and enjoy the game.


    Mod Switching

    This method can be used as a very efficient mod switching mechanism:
    Proceed as above, but before saving your .cfg file, add the following:
    Code:
    [features]
    mod = mymodfolder
    The mymodfolder is a placeholder for your personal mod folder, so say you have a mod called "Fishpants", then create a subfolder inside your MTW2 directory called "Fishpants", then add "mod = Fishpants" to your configuration file.
    A mod directory will require the data/world/maps/base and data/world/maps/campaign/imperial_campaign folders to work and data/sounds/events.idx and data/sounds/events.dat in order to include sounds.
    It should supercede any packed files, but that may actually only be the case after the unpacking tool has been released by CA.
    Last edited by alpaca; 10-29-2007 at 18:12.

  2. #2
    Just driving-by Senior Member Epistolary Richard's Avatar
    Join Date
    Nov 2004
    Posts
    4,376

    Default Re: Command line switches

    Added results from Brisbane visit.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  3. #3
    Member Member wilddog's Avatar
    Join Date
    Nov 2004
    Posts
    107

    Default Re: Command line switches

    ER
    A couple of comments as I've used that set up for testing - and its great

    1) If you don't use your own bat file and CFG and instead just amend the medieval2.preference.cfg file - it lasts for one go and then the game will overwrite the medieval2.preference.cfg file and effectively wipe out any extra lines you added.

    2) Regarding the use of

    [log]
    to = logs/system.log.txt
    level = * trace

    and

    level = * error

    If you put both in it will use the last one eg

    [log]
    to = logs/system.log.txt
    level = * trace
    level = * error

    works with just error on.

    Just in case like me you get over tired and just can't quite remember what the other command was.

  4. #4
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Command line switches

    Changed the first post to a more tutorial-like layout and added wilddogs finds.
    Keep up the good work wilddog, as soon as I get the game I'll support you with research

  5. #5
    Member Member wilddog's Avatar
    Join Date
    Nov 2004
    Posts
    107

    Default Re: Command line switches

    Alpaca
    No problem. The trace command is superb - once you know you've got an error otherwise it really creates a lot of text. You can still search through it though for the 'error' and it will find it so just a much more detailed set of information of exactly what has happened.

    eg tells you you have wrong file sizes on maps so points you to correcting the descr_terrain.txt file if you forgot to change or identifies the TGA that you forgot to resize.

    Suspect it really comes into its own with script debugging or possibly traits.

  6. #6
    Member Member wilddog's Avatar
    Join Date
    Nov 2004
    Posts
    107

    Default Re: Command line switches

    I guess one other little thing. If you do then change the options within the game ...they don't affect your *.cfg file referenced from the *.bat file. I believe they go only back to the original .cfg

  7. #7
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Command line switches

    Yes I also noticed this. It's a bit of a bummer tbh because every change you make has to be redone by hand.

  8. #8
    Member Member mattep74's Avatar
    Join Date
    Jan 2003
    Location
    Vasteras, sweden
    Posts
    26

    Default Re: Config File & .cfg Switching

    Disabling the Videos

    If you want to disable the movies for the game ("-nm" switch in RTW), use:
    Code:
    [video]
    movies = false


    .cfg Switching

    The .cfg switching mechanism allows you to use different game configuration.
    To start the game using a different config file, you have to create a new batch file (create a new text file and rename the file extension to .bat) in your MTW2 directory, that looks like this:
    Code:
    medieval2.exe @mod.cfg
    Then create a copy of your medieval2.preference.cfg, rename it to mod.cfg (you can use any name here, just remember to also change it in the .bat file) and make your changes. Then create a shortcut to your newly-created .bat file and enjoy the game.

    please help.

    One. How do i disable the movies so that they stay disabled? Do i cut everything under video away or?

    And create a shortcut to you newly-created .bat. How do you mean? A shortcut in the file or what?

    I am a rookie when it comes to codes and the most i have done is changing how much silver is worth in Sid Meiers colonization:)

  9. #9
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Command line switches

    To disable videos you need to create your own configuration file.
    With shortcut I mean windows shortcut (right-click, create shortcut)

  10. #10
    Spindly Killer Fish Member ShellShock's Avatar
    Join Date
    Aug 2004
    Location
    UK
    Posts
    189

    Default Re: Command line switches

    I would just like to add that a bat file is not necessary for running a mod via the "mymod" switch. Instead you can just to create a shortcut directly to the medieval2.exe, and add the mod switch to the shortcut arguments.

    To see what I mean you can try it manually. Copy and paste the existing "Medieval II Total War" shortcut that was created when you installed the game. Right click the new shortcut and select Properties from the pop-up. On the Shortcut tab, go to the Target field. This should be something like

    "C:\Program Files\Sega\Medieval II Total War\medieval2.exe"

    Change it to

    "C:\Program Files\Sega\Medieval II Total War\medieval2.exe" "@MyMod.cfg"

    where MyMod.cfg is the name of your mod cfg file. This shortcut will now run the mod.

    Perhaps some mod authors are considering using the bat file method as this can be programmed more easily in their mod installer compared to creating a short cut. But then the user has to run the bat file to play the mod - there is no shortcut icon to the bat file. Ah ah - why not create a shortcut to the bat file as part of the mod installation? But if you are going to do that you might as well create a shortcut direct to medieval2.exe.

    I hope this helps.
    He does sit in gold, his eye red as 'twould burn Rome.

  11. #11
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Command line switches

    Very nice, might not have thought of that, myself!

  12. #12
    Cydonian Member serenius4tsd's Avatar
    Join Date
    Sep 2006
    Location
    Out there in the wild...
    Posts
    58

    Default Re: Command line switches

    Anyone know what the -ai command line equivalant to M2TW is?

  13. #13
    Magister Vitae Senior Member Kraxis's Avatar
    Join Date
    Feb 2002
    Location
    Frederiksberg, Denmark
    Posts
    7,129

    Default Re: Command line switches

    Which one of the video 'options' relate to generals and their deaths? I don't really want to see it anymore, but I don't want to disable the other movies in case everything is disabled.
    You may not care about war, but war cares about you!


  14. #14
    Member Member grinningman's Avatar
    Join Date
    May 2006
    Posts
    62

    Default Re: Command line switches

    Quote Originally Posted by Kraxis
    Which one of the video 'options' relate to generals and their deaths? I don't really want to see it anymore, but I don't want to disable the other movies in case everything is disabled.
    event_cutscenes = 0
    Last edited by grinningman; 12-16-2006 at 10:51.

  15. #15
    Member Member grinningman's Avatar
    Join Date
    May 2006
    Posts
    62

    Default Re: Command line switches

    A mod directory will require the data/world/maps/campaign/base and data/world/maps/campaign/imperial_campaign folders to work and data/sounds/events.idx and data/sounds/events.dat in order to include sounds.
    If I include these files and folders the mod works, but there are no splash screens when the loading bar is showing. How do I get the splash screens to appear in a mod?

  16. #16
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default Re: Command line switches

    Quote Originally Posted by grinningman
    If I include these files and folders the mod works, but there are no splash screens when the loading bar is showing. How do I get the splash screens to appear in a mod?
    Same here. No splash screens, and no fmvs either. Copying the loadingscreen folder to the mod folder works, but the fmv folder is 1.7 Go... Not sure it'll be practical to copy it in every single mod :)
    Last edited by Kobal2fr; 12-18-2006 at 22:38.
    Anything wrong ? Blame it on me. I'm the French.

  17. #17
    Relentless Bughunter Senior Member FactionHeir's Avatar
    Join Date
    Dec 2006
    Location
    London, UK
    Posts
    8,115

    Default Re: Command line switches

    What I did to force the config file to keep my videos off was to make it read only. Only downside is that if you want to change your config in game (which you tend to not do once you found your own optimum) you'll have to make it writable again, but thats really minor.
    Saves some trouble with having to run a specific cfg file though.
    Want gunpowder, mongols, and timurids to appear when YOU do?
    Playing on a different timescale and never get to see the new world or just wanting to change your timescale?
    Click here to read the solution
    Annoyed at laggy battles? Check this thread out for your performance needs
    Got low fps during siege battles in particular? This tutorial is for you
    Want to play M2TW as a Vanilla experience minus many annoying bugs? Get VanillaMod Visit the forum Readme
    Need improved and faster 2H animations? Download this! (included in VanillaMod 0.93)

  18. #18
    Ja mata, TosaInu Senior Member edyzmedieval's Avatar
    Join Date
    May 2005
    Location
    Fortress of the Mountains
    Posts
    9,439

    Default Re: Command line switches

    Ok, now this probably hasn't happened to you guys, but it is for me.

    My .cfg doesn't have [misc].
    Ja mata, TosaInu. You will forever be remembered.

    Proud

    Been to:

    RANDOM WANDER- check out my blog!

    Fall of Constantinople - CLICK!!! - Historical novel about the fall of Byzantium!

  19. #19
    Member Member wilddog's Avatar
    Join Date
    Nov 2004
    Posts
    107

    Default Re: Command line switches

    I guess others probably realised this but with regard to the log commands the default is actually * warning

    Regarding the use of

    [log]
    to = logs/system.log.txt
    level = * trace

    and

    level = * error

    If you put both in it will use the last one eg

    [log]
    to = logs/system.log.txt
    level = * trace
    level = * error
    If you add the level = * warning or have no level command then you get the errors + warning commands (although warnings are misleading as you get a lot of them anyway).

  20. #20
    Legatus Member SigniferOne's Avatar
    Join Date
    Oct 2004
    Posts
    550

    Default Re: Command line switches

    Nice point, wilddog. Edzymedieval, just create the [misc] :)

  21. #21
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,838

    Default Re: Config File & .cfg Switching

    Code:
    [features]
    mod = mymodfolder
    The mymodfolder is a placeholder ... A mod directory will require the data/world/maps/campaign/base ...
    Just a typo I'm sure, but that should be data/world/maps/base or bad things happen; base is in the maps folder, not the campaign folder.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  22. #22

    Default Re: Command line switches

    Quote Originally Posted by kraxis
    Which one of the video 'options' relate to generals and their deaths? I don't really want to see it anymore, but I don't want to disable the other movies in case everything is disabled.

    Quote Originally Posted by grinningman
    event_cutscenes = 0

    I've been having problems with these cut scenes causing the program to quit when I kill the enemy general. Where does this line need to be added?

    I've tried adding
    [video]
    movies = false

    to the cfg but that must control something else.

    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •