ASH print() to session log?

mitchelljpaul

New member
Hey, I'm a new to KoLmafia, but certainly not new to scripting/programming. Just a quick question about getting output to one of the text files in KoLmafia's session directory. I've tried using the ASH print() command, as well as echo from the CLI, and while both of these commands dump to the CLI, I don't see them in the log.

Anyone know how I can get a line printed to the session log?
 

Nightmist

Member
I'm not to sure about the actual session log but I do know that you can "mirror" text in the CLI to another file by using the "mirror <filename>" CLI command.
It's the best I can think of right now, I have never personally bothered using the session logs mafia makes so I can't really give too much help there.
 

mitchelljpaul

New member
Thanks. I actually just stumbled across the mirror command, and was delving into that. Unfortunately, it looks like mirror overwrites any preexisting file, rather than appending to it. I can work around that within a single script by saving all of my output until the end of execution and dumping it in one fell swoop, but I'd rather append if possible.

I'm unable to find any documentation on the mirror command. Does anyone know where I can find it, or how I might be able to modify the file writing mode? (On a whim, I tried mirror >>test.txt, like PERL's open(INFILE, ">>test.txt"); but to no avail.
 

Nightmist

Member
[quote author=mitchelljpaul link=topic=662.msg3088#msg3088 date=1166734428]
I'm unable to find any documentation on the mirror command. Does anyone know where I can find it, or how I might be able to modify the file writing mode? (On a whim, I tried mirror >>test.txt, like PERL's open(INFILE, ">>test.txt"); but to no avail.
[/quote]
Theres some documentation in the scripting commands in the basic CLI scripting section of the user manual.
Chances are your test didn't work because ">" is a invalid character for use in a filename in windows.
 
Code:
mirror test.txt
will mirror the output to a file called test.txt in the kolmafia directory.
Code:
mirror \chardata\\test.txt
will mirror the output to a file called test.txt in the chardata subdirectory of the kolmafia directory

So if you have kolmafia in c:\windows\desktop\kolmafia the file will be placed in c:\windows\desktop\kolmafia\chardata

note the double backslash between the path and filename...it must be double for it to work properly. The file name and sub folder do not have to exist. kolmafia will create them as needed. if you are saving a file to "kolmafiadir\scripts\chardata" it may be "\scripts\\chardata\\test.txt" or "\scripts\chardata\\test.txt" I am unsure.
 
Top