yeah I found that but it was messy.
I got it working in the end with a 3rd party tool called netcat.
https://eternallybored.org/misc/netcat/
for anyone who finds this post and wants to do a similar thing, here is what I did.
Download netcat from the above link. I downloaded the 32bit version and extract the nc.exe file to wherever you need it. Mine was in "E:\openttd\Manager"
browse to the folder in powershell ISE.
run this code.
Code: Select all
$process = New-Object System.Diagnostics.Process
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.RedirectStandardOutput = $true
$process.StartInfo.RedirectStandardError = $true
$process.StartInfo.CreateNoWindow = $false
$process.StartInfo.FileName = "E:\openttd\Manager\nc.exe"
$process.StartInfo.Arguments = "-l -p 3982"
$process.Start() | Out-Null
do
{
$outvar = $process.StandardOutput.ReadLine()
$outvar
}
while (!$Process.HasExited)
$process.WaitForExit()
what this does is it will open the "nc" application and listen for any incoming information on port 3982.
once that is done, create a shortcut to openttd.exe, right click it and go to properties.
Under target, put these command line options at the end of the line
-D -d 2 -l 10.1.1.10
so it will looks something like
"E:\openttd\openttd.exe -D -d 2 -l 10.1.1.10"
note: the IP address i use for my internal network "10.1.1.10" is the ip address of the computer that is running the above powershell code.
the commandline -l <IP> outputs to a network port which in this case is netcat
if everything is done right, when you run the shortcut, it will load the dedicated server and output everything to the powershell window
If you have any questions or need help with this, let me know, I can do my best to assist
