JMC Logger by p(Dalir) This script is a replacement for JMC's #log command that doesn't seem to insert line breaks after user input within the log file. Settings: Change 'dir' to your log directory. Change 'overwrite' to true to set overwrite as the default. Change 'remove_ansi' to false if you want ANSI colors written to the logs. Commands: log - Toggles overwrite/append to log file log - Opens log file ----------------------------------------- To install, add this alias to your .set file or in JMC itself: #alias {log} {#script log "%1"} And paste the following code in settings\commonlib.scr: Sub Jmc_Incoming(line) writelog_incoming(line) End sub Sub Jmc_Input(line) writelog_input(line) End sub '**************************************** 'JMC Logger by p(Dalir) 'Replacement for JMC's log command. '**************************************** Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim logging, dir, overwrite, fso, stream dir = "C:\" 'Change this to your log directory overwrite = False 'Change this to true to set overwrite to default remove_ansi = True 'Change this to false to not remove ansi commands sent from mud Set fso = CreateObject("Scripting.FileSystemObject") logging = False Sub log(filename) Dim add_crlf 'Used when appending to a textfile, adds two newlines for neatness 'If filename is not defined, stop logging or toggle overwrite/append If filename = "" Then If logging Then logging = False stream.Close jmc.showme "#Logging stopped" Exit Sub Else overwrite = Not overwrite If overwrite Then jmc.showme "#Logging changed to overwrite" Else jmc.showme "#Logging changed to append" End If End If Else If logging = False Then logging = True add_crlf = fso.FileExists(dir & filename) If overwrite Then jmc.showme "#Logging started (overwrite)" Set stream = fso.CreateTextFile(dir & filename, True) Else jmc.showme "#Logging started (append)" Set stream = fso.OpenTextFile(dir & filename, ForAppending, True) if add_crlf Then stream.Write VBCrLf & VBCrLf End If End If stream.WriteLine "#Logging started " & Date & " at " & Time Else jmc.showme "#Already logging, use 'log' to stop" End If End If End Sub Sub writelog_incoming(line) 'Remove ANSI symbols if remove_ansi Then line = Replace(line, Chr(27) & "[0m", "") For i = 0 to 97 line = Replace(line, Chr(27) & "[" & i & "m", "") Next End If 'Write text from mud to log file If logging Then If InStr(line, ">") Then stream.Write line Else stream.WriteLine line End If End If End Sub Sub writelog_input(line) 'Write user input to log file, ignore "log" command itself and closing JMC commands If logging And line <> "log" And Not InStr(line, ";#write") And line <> ";#killall" Then stream.Write line stream.Write chr(13) + chr(10) End If End Sub