Logging in in text only mode

SuperAscender

New member
first some context:

I'm working on a buffbot run using mafia. It will be run on a headless linux box using cron.

I created a separate folder on my windows box for setting up the buffer files. In that folder I put the mafia jar file. Next I logged into the character, making sure that the save password box was checked, and set up all the buffbot information and whitelist. Then I uploaded that whole folder including the mafia jar, settings folder, buff folder, etc., to the linux box.

/context

I am able to start mafia in text only mode. When I try to log in using "login character_name" it says password isn't store for that account. I did save the password for that account in the gui mode, so I'm not sure what I'm doing wrong.

Hopefully all that is understandable.

super
 
Do you type "login character_name" manually or is it part of a script? If it is part of a script try typing it in manually and it should give you the chance to type the password in. This should save the password again, and you should be able to login via the script again.

You may find more settings missing though. If this is the case you may have a cross platform file saving format problem. It would probably be a lot easier to set up the files on a Linux based machine for use on a Linux based machine.
 

SuperAscender

New member
Sorry I didn't get back sooner. I've checked through the settings files on the linux box and I don't seem to see anything different. Just to try...where are passwords stored in mafia settings files? I know theyre encrypted and I couldn't get anything from them, but I would like to see if they are there in the file. thanks

super
 

Nightmist

Member
[quote author=SuperAscender link=topic=664.msg3142#msg3142 date=1167492274]
where are passwords stored in mafia settings files?[/quote]
"prefs_GLOBAL.txt" in the settings folder.

Specifically this value: "saveState.USERNAME=NumericalString"
 
often when viewing the files, you cannot see the difference.
example: the attached file
open it in notepad on a windows based machine. You will see there are no line breaks that notepad recognizes. I don't have a linux box to test on, but I imagine if you opened it on one, then you would find that it has line breaks. Windows Wordpad understands how the file was written, and when the file is opened in wordpad linebreaks are displayed. The point there is if the program you are using understands the method used in saving the files, then it will appear exactly the same in the program.

Kolmafia was designed to work across platforms, but I don't know that the settings files were designed to be moved from platform to platform. If kolmafia uses "System.getProperty("line.separator")" to save the settings files and then again to load the file, then a cross platform issue arises when trying to move the files from platform to platform. The reason is System.getProperty("line.separator") returns the platform specific line separator for the operating system you are using. Windows uses different line separator than Linux, and I believe Macintosh uses a third different line separator.

Now on to testing my theory. create a new folder on the linux box, and copy kolmafia (program only) to the folder. Start kolmafia from the folder, login, then exit kolmafia. Copy the files in the settings folder back to the windows machine, and open in notepad. Does it appear the same as the files created on the windows machine? If there are weird characters where the linebreaks should be, or no linebreaks, then the problem I am describing is the problem. That leaves you with either setting it up on a machine that runs the same OS as the one you are running it on, or figuring out how to convert it.
 

Attachments

  • adventures.txt
    5.5 KB · Views: 90

Nightmist

Member
Semi-ontopic:
Oh so thats why notepad never liked .dat's, I opened one in a hexeditor and only found a "0A" value for each linebreak but notepad needs both "0D 0A" (In that order) where as wordpad recognises a linebreak when u have either "0D" or "0A" and also realises to only put 1 linebreak when they are in the order "0D 0A" ("0A 0D" is printed in wordpad as 2 line breaks.)

Anyway yeah, you cant really trust what your being shown is "everything" that file is made up of. (And programs on different platforms might handle those hidden pieces differently. (Which might cause incompatibility))
 
Overly confusing for those who don't understand hexadecimal, and character codes, but yeah you got it. The whole line ending issue has it's roots in them old printers that used fan-fold paper a mile long, and sounded like a sewing machine on speed. The various printers had different reactions to 0A, 0D0A, and 0D which was similar to the oddities you see with the various editors, and some were worse.

an example of worse: on a printer that wanted 0D0A to start at the beginning of a new line if it only received 0D it would return to the beginning of the current line, and proceed to type over what it just typed. If it were in the middle of a line, and received 0A it would go to the next line, but start in the middle of the line (where it left off on the previous line).

Though this becomes less of an issue as standards are set, and programs are written to better handle these cases this issue still haunts programmers, and end users from time to time.
 

SuperAscender

New member
Ok well I redid all the files in linux and tried it again...this time I'm not sure what happened. I said mafia was running in linux, but then it took me back to the main shell, I couldn't enter anything else in the CLI and java wasn't running as a process when I checked it.

super

P.S.: the command I used to start mafia was:

Code:
java -jar KoLmafia-10.0.jar --CLI script=scripts/login.txt

login.txt was:

Code:
login character_name
call script_name.ash
exit
 

SuperAscender

New member
[quote author=holatuwol link=topic=664.msg3414#msg3414 date=1169606979]
Remove script=
[/quote]

I just tried this and no go...any other ideas?
 

SuperAscender

New member
[quote author=efilnikufecin link=topic=664.msg3431#msg3431 date=1169682662]
Holatuwol said in another thread he forgot to add that --CLI needs to be removed, or placed as the last parameter.
[/quote]

This worked =D I just stuck the --CLI at the end. The final command looked like so:

Code:
java -jar KoLmafia-10.0.jar script=scripts/login.txt --CLI

thanks for all of your guys' help.

super
 
Top