Jump to content

Recommended Posts

Posted

Hi all,

I'm not very good with LUA, and I'm seeking a way that will anyble a player to preserve his/hers online results permanently.

 

As mp_log is reset each time you start/access a mission, I'm interested into something that would automatically create a copy of mp_log, in a form mp_log_date_time.txt.

 

So far I managed either nothing or to crash FC :cry:

 

Thanks in advance

I'm selling MiG-21 activation key.

Also selling Suncom F-15E Talon HOTAS with MIDI connectors, several sets.

Contact via PM.

Posted
Hi all,

I'm not very good with LUA, and I'm seeking a way that will anyble a player to preserve his/hers online results permanently.

 

As mp_log is reset each time you start/access a mission, I'm interested into something that would automatically create a copy of mp_log, in a form mp_log_date_time.txt.

 

So far I managed either nothing or to crash FC :cry:

 

Thanks in advance

I'm relying on dim and distant memories of a bygone era, so I could well be wrong. However, try:

 

COPY FILENAME FILENAME.%DATE%

 

Open NotePad. Enter the above text (with the correct file name substituted). Save it with any name you want but make the suffix bat (it stands for batch file). So something like CopyMP-Log.bat.

 

Put it in the folder where the MP log lives and make a Desktop shortcut that points to it. When you click the shortcut, the batch file should generate a copy of the MP log with the date & time added to the file name--unless, of course, my memory is completely screwed...which is entirely possible. It's been a very long time since I last messed with DOS.

 

Unfortunately, I'm away from my home computer and, so, can't test this myself.

 

Rich

YouTube Channel: https://www.youtube.com/channel/UCU1...CR6IZ7crfdZxDg

 

_____

Win 11 Pro x64, Asrock Z790 Steel Legend MoBo, Intel i7-13700K, MSI RKT 4070 Super 12GB, Corsair Dominator DDR5 RAM 32GB.

Posted

Thanks fore reply. I remember that tip from before. I've made following work:

 

COPY mp_log.txt mp_log.txt.%DATE

 

But then I get a file named mp_log.txt.DATE - where word DATE is inserted, not actual date!

 

Anyway, it involves manual running that script after each MP session. Any chance to do that atuomatically using LUA? Like in that other link I've dug out, but also can't make it work:

Lua script: record player's a2a kills/deaths to HTML file

I do not know how to use LUA to make a copy of existing file, but it should be possible. Something similiar is done in Tacview, but I can't figure it out.

I'm selling MiG-21 activation key.

Also selling Suncom F-15E Talon HOTAS with MIDI connectors, several sets.

Contact via PM.

Posted
...I've made following work:

 

COPY mp_log.txt mp_log.txt.%DATE

 

But then I get a file named mp_log.txt.DATE - where word DATE is inserted, not actual date!

That's because I didn't have it right. The following two lines will copy the file and rename it "yyyy/mm/dd".txt:

 

copy temp\mp_log.txt temp\mp_log2.txt

 

FOR /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "temp\mp_log2.txt" %%g-%%e-%%f.txt

 

Anyway, it involves manual running that script after each MP session. Any chance to do that atuomatically using LUA?

Unfortunately, I know nothing about coding LUA files. However, if you normally start the sim from from your Desktop and join servers directly (not through Hyperlobby, etc.), the following will alleviate the problem:

 

@echo off

 

copy temp\mp_log.txt temp\mp_log2.txt

 

FOR /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "temp\mp_log2.txt" %%g-%%e-%%f.txt

 

start lockon.exe

exit

 

Paste the above text into NotePad and save it. Name it whatever you want with the BAT suffix. Example: Save_MP_Start_FC.bat. Put the file in your main Lock On directory (where lockon.exe lives). Create a Desktop link and use that to start the sim. This will copy and rename the old file and, only then, start the sim. That's the best I can do. We need someone with far more expertise to wander through. :)

 

Rich

YouTube Channel: https://www.youtube.com/channel/UCU1...CR6IZ7crfdZxDg

 

_____

Win 11 Pro x64, Asrock Z790 Steel Legend MoBo, Intel i7-13700K, MSI RKT 4070 Super 12GB, Corsair Dominator DDR5 RAM 32GB.

Posted

Thanks Ironhand!

 

While waiting for your answer I was searching around and I came up with similiar solution to rename mp_log. Combined with your latest tips for automatic startup of LO, it looks like this:

 

@echo off
copy temp\mp_log.txt temp\mp_log2.txt
for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set XDate=%%b
for /f "tokens=1-2 delims=: " %%a in ('time /t') do set XTime=%%a-%%b
rename "temp\mp_log2.txt" "mp_log_""%Xdate%_%XTime%".txt
start lockon.exe
exit

 

Renamed file looks like this:

mp_log_09.06.2008_16-21.txt

(any idea how to insert seconds after minutes?)

 

Works fine, copies mp_log and starts LO. Many thanks again and again :thumbup:

 

Even this is fine, I find it to be intermediate sollution, as it is a bit clumbsy to exit and start LO each time you want to acces new MP session.

 

Could someone take a look at this thread:

Lua script: record player's a2a kills/deaths to HTML file

 

There is an explanation how to make a html file out of mp_log, but it is for LO,not for FC, and I can't make it work :(

I'm selling MiG-21 activation key.

Also selling Suncom F-15E Talon HOTAS with MIDI connectors, several sets.

Contact via PM.

Posted
...

 

for /f "tokens=1-2 delims=: " %%a in ('time /t') do set XTime=%%a-%%b

...

 

(any idea how to insert seconds after minutes?)

Try:

 

for /f "tokens=1-3 delims=: " %%a in ('time /t') do set XTime=%%a-%%b-%%c

 

Once again, I'm at work and can't check for myself, if it's correct.

 

Rich

YouTube Channel: https://www.youtube.com/channel/UCU1...CR6IZ7crfdZxDg

 

_____

Win 11 Pro x64, Asrock Z790 Steel Legend MoBo, Intel i7-13700K, MSI RKT 4070 Super 12GB, Corsair Dominator DDR5 RAM 32GB.

Posted

Something like this (haven't tested it but it should be close)

 

 

 

 

 

function LuaExportStop()

-- open the mp log for reading

--

local mp_log = io.open("./Temp/mp_log.txt", "r")

-- create the file name (date format YYMMDDHHMMSS)

--

local output_filename = "mp_log_" .. os.date("%y%m%d%H%M%S") .. ".txt"

 

-- open the output file for writing

--

local output = io.open(output_filename, "w")

-- read the whole file (*all) and write it to the output

--

output:write(mp_log:read("*all"))

-- close the files

--

output:close()

mp_log:close()

end

 

Let me know if you need more help.

Posted

Tested, not working. Played around with date/time format, copied some strings from tacview, but this is trully not my field.

Mugatu, thanks, but this will need some testing from your side, I'm out of ammo :S

I'm selling MiG-21 activation key.

Also selling Suncom F-15E Talon HOTAS with MIDI connectors, several sets.

Contact via PM.

Posted

WAIT WAIT!!

This one is working:

	local mp_log = io.open("./Temp/mp_log.txt", "r")
local output_filename = "./Temp/mp_log_" .. os.date("%Y%m%d-%H%M%S") ..".txt"
local output = io.open(output_filename, "w")
output:write(mp_log:read("*all"))
output:close()
mp_log:close()

Its working! Its working! Its working! Its working!:punk:

 

YEAH!

 

Thanks Mugatu! Yeah, I saw that quote, and I played around with the code (looking into othere examples for solution), neverthwless, this one would not be possible without your help :thumbup:

 

Thanks again!

 

PS - I'm glad that I've managed the same solution for missing part, even if it is only ".txt" ;)

I'm selling MiG-21 activation key.

Also selling Suncom F-15E Talon HOTAS with MIDI connectors, several sets.

Contact via PM.

  • 6 years later...
Posted

I know this is a very old thread, but I found it right now and have a question: what should I do to can copy an image file with this code (or any other), because it works for text files but not for images (jpg).

Thanks.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...