Jump to content

how do i retrieve (dedicated) server info via mission script?


Go to solution Solved by Zyll,

Recommended Posts

Posted (edited)

Some context on exactly what I'm trying to do:

We have 5 dedicated servers (all same IP, different ports), and have SRS running too, one instance per dedicated server. I am trying to have a mission be aware of which instance they are on, so I can dynamically set the SRS port configured in the script for Text-to-Speech support. You don't need to understand how SRS TTS works or anything, the simple ask is whether I can pull ANY server info from within my mission script (which happens to run as DO SCRIPT as opposed to DO SCRIPT FILE if that matters). A getter to retrieve the server name, IP/port, description, even local file system folder where the miz is located... any of these would suffice for my purposes. Our servers have sanitization turned off.

I did ask this in another thread a while back but didn't get anywhere at the time, hoping there might be some new(er) insight.

Thanks all,

Edited by Zyll
Posted
49 minutes ago, Zyll said:

Some context on exactly what I'm trying to do:

We have 5 dedicated servers (all same IP, different ports), and have SRS running too, one instance per dedicated server. I am trying to have a mission be aware of which instance they are on, so I can dynamically set the SRS port configured in the script for Text-to-Speech support. You don't need to understand how SRS TTS works or anything, the simple ask is whether I can pull ANY server info from within my mission script (which happens to run as DO SCRIPT as opposed to DO SCRIPT FILE if that matters). A getter to retrieve the server name, IP/port, description, even local file system folder where the miz is located... any of these would suffice for my purposes. Our servers have sanitization turned off.

I did ask this in another thread a while back but didn't get anywhere at the time, hoping there might be some new(er) insight.

Thanks all,

 

Without writing a server hook, this is all you can get from the Mission Scripting Environment:

https://wiki.hoggitworld.com/view/DCS_singleton_net

 

I'd suggest you write a server hook and put it on each server and then feed that information into your mission script via your own TCP link.

https://wiki.hoggitworld.com/view/DCS_server_gameGUI

  • 4 weeks later...
Posted

I know this is probably not the best way of doing it but... on each server (or in each instance folder), could you create a text file with the file name being that of the "server", for example, create a file called    'Server1.txt' and save it on the server. Then use the myFile = io.open('Server1.txt') and if myFile ~= nil then you know you are on Server1

You could just try opening the name of each server until myFile ~= nil and then you know you have whatever server you were looking for.

 

I'm actually trying to find the same solution for the same reasons you are. Need to test my idea.

Posted

Io.open would require a full path to the file on the file system, so I think your idea would work only if your different servers were on separate physical servers. If you had 2 dedicated servers separated by folders under Saved Games, I'm not sure you would be able to make it work.

Certainly interested to know if you make something work, else check out that link that Tempest posted, it definitely worked for me.

Zyll @ TAW

  • Solution
Posted

turns out I could have just made my life a whole lot easier with this simple line in a mission script (assuming sanitization is turned off):
 

lfs.writedir()

I can determine the server with this since the path will be specific to the folder under Saved Games that it was installed.

alternatively this worked just fine too:
 

dofile(lfs.writedir() .. "Config\\serverSettings.lua")

grab any server setting from this file

  • Recently Browsing   0 members

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