Jump to content

[SOLVED] Making the .bat file automatically load the latest autosave file.


Recommended Posts

Okay, I've been doing some googling and I was able to find this piece of code, but I'm not sure exactly how I'm supposed to utilize it in the .bat file for starting a dedicated server in command.

./openrct2 $(ls -t1 | head -n 1)

or

ls -1 autosave*sv6 | tail -n 1

They are from these two threads;

https://github.com/OpenRCT2/OpenRCT2/issues/4152

https://www.reddit.com/r/openrct2/comments/6q81jy/how_do_i_enable_autosaves_on_a_headless_dedicated/

What exactly should I write in my .bat file to allow it to open up the latest autosave. This is what my .bat file currently looks like.

cd C:\Program Files\OpenRCT2
openrct2 host C:\Users\Atlas\Documents\OpenRCT2\save\onlinev1.sv6 --port 11755 --headless

- - - - - -

Windows 10

Running Release Build of OpenRCT2 0.2.6 (6c3c857)

Edited by AirplaneRandy
Link to comment
3 hours ago, AirplaneRandy said:

I'm not sure exactly how I'm supposed to utilize it in the .bat file for starting a dedicated server in command.

Shell scripts are just lists of shell commands - whatever you would type on the terminal is what you write in the shell script. But `ls` is a Unix command so this code looks like it's written for use on Linux or Mac - you will probably have to modify it to use it with a Windows batch script.

  • Like 1
Link to comment

I asked about this problem on reddit and a friendly fellow was able to pull it off in powershell. Developers, I strongly recommend you guys add this information to the multiplayer help page on github.

https://github.com/OpenRCT2/OpenRCT2/wiki/Multiplayer

https://old.reddit.com/r/techsupport/comments/h02rvn/i_got_a_bat_file_that_opens_up_a_dedicated_server/

$lastwritten = Get-ChildItem -path C:\Users\Atlas\Documents\OpenRCT2\save\autosave | Sort-Object LastWriteTime | Select-Object -last 1
& 'C:\Program Files\OpenRCT2\openrct2' host "C:\Users\Atlas\Documents\OpenRCT2\save\autosave\$lastwritten" --port 11755 --headless

 
Edited by AirplaneRandy
Link to comment
2 hours ago, AirplaneRandy said:

I asked about this problem on reddit and a friendly fellow was able to pull it off in powershell. Developers, I strongly recommend you guys add this information to the multiplayer help page on github.

As far as I can tell, that page can be edited by anyone, so you could just add it yourself.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...