Command line options?

Theraze

Active member
Is there a list of command line options that mafia accepts anywhere? I just tried to find it in the wiki and couldn't see anything. Headless doesn't find anything at all in the wiki, but I know that people do use mafia in headless mode... but what else is available? :)
 

holatuwol

Developer
Natively, I think we only accept --CLI (which tells KoLmafia to not load any user interface and do everything from the command line until you type in a GUI command like priphea; this is actually how I usually load KoLmafia nowadays, and it's handy since if you hit enter when it prompts you for a username, it drops you straight into KoLmafia's CLI and lets you run any scripts that do not require login) and the ability to specify a script to startup with. The script thing is usually only useful for cron tasks, but since you can just use < to redirect a file to standard in, the property isn't all that useful.

However, you can set all the Java system properties on the command line (you specify them by saying "java -Dname=value"), which allows you to change things like where KoLmafia tries to save files (there's one that KoLmafia checks called 'useCWDasROOT' to see if it should use Windows-like behavior on Linux and OSX, and you can specify the current working directory by setting "user.dir"). There's also a few that aren't listed on that list, like java.awt.headless=true for telling Java never to try to load an AWT window (which is the base for Swing, which is what KoLmafia uses for its GUI) and a few that are Java implementation specific (so they differ between OpenJDK, Harmony, GCJ and Sun/Oracle Java -- example Sun list).

Some other useful ones are -Xms and -Xmx (which specify your memory settings) and -Xincgc which changes the way Java does garbage collection. Since KoLmafia's a standalone Swing application, -Xincgc is really the only one that's sensible. Other useful things are setting your time zone (-Duser.timezone=GMT) and, depending on what version of Java you're using, you can also set network timeouts and all that fun stuff to fine-tune the way that KoLmafia runs. But all that said and done, it's just a simple desktop application so most of the cool Java VM flags don't make much sense.
 
Last edited:

Theraze

Active member
Ah, okay. I was wondering if this would help out bordemstirs in the attempt to have different characters login in an automated way... --CLI with < *character1session*.txt should work if it's running headless, right?
 

holatuwol

Developer
Theoretically yes, if the password is remembered, auto-login is disabled and the first line of "character1session.txt" was the user's login name.
 
Any way to do this in a headed environment?

If not I can get used to the headless... but just in case: I can still type "abort" to stop the script and then ... there's a command to load the full GUI frame, yeah?
 
Top