Jump to content

Detect server without graphics by script


Recommended Posts

Hi,

I'm looking urgently for a way to detect if DCS was launched in --server mode or if the was launched the dedicated server version, using anything in LuaHooks _G or in hooks environment, before launching the mission.

This is needed for DSMC mod, to detect if the user launching DCS have access to the options menù or not.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Simple ( but dirty ) way that comes to my mind for a quick workaround, could be read the dcs.log
On second line you have all the arguments. its not 100% accurate since some people can mess the starting arguments, but it could be a starting point.

 

=== Log opened UTC 2022-11-01 13:00:50
2022-11-01 13:00:50.652 INFO    APP (Main): Command line: DCS.exe  --server --norender -w SyriaLiberation

 


Edited by Maverick87Shaka

FlighRIG => CPU: RyZen 5900x | RAM: 64GB Corsair 3000Mhz | GPU: nVIDIA RTX 4090 FE | OS Storage: SSD NVMe Samsung 850 Pro 512GB, DCS Storage: SSD NVMe Sabrent 1TB | Device: Multipurpose-UFC, VirPil T-50, TM WARTHOG Throttle, TrackHat, MFD Cougar with screen.

Our Servers => [ITA] Banshee | Krasnodar - PvE | PersianConquest PvE Live Map&Stats | Syria Liberation PvE Conquest

Support us on twitch subscribing with amazon prime account linked, it's free!

Link to comment
Share on other sites

3 ore fa, Maverick87Shaka ha scritto:

Simple ( but dirty ) way that comes to my mind for a quick workaround, could be read the dcs.log
On second line you have all the arguments. its not 100% accurate since some people can mess the starting arguments, but it could be a starting point.

 

=== Log opened UTC 2022-11-01 13:00:50
2022-11-01 13:00:50.652 INFO    APP (Main): Command line: DCS.exe  --server --norender -w SyriaLiberation

 

 

Yep that would a dirty but working solution, I was only asking if there are variables that could lead me to the same result without having to open the dcs.log (i.e. the logger function to print the command line, for example, or the variable called when you set --server)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Uhm just read this in the API, I'll try:

  • DCS.getLogHistory(from) -> {{abstime, level, subsystem, message}, ...}, last_index

    Returns last log messages starting from a given index.

    Usage:

      local logIndex = 0;
      local logHistory = {}
      logHistory, logIndex = DCS.getLogHistory(logIndex)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Are any of these related functions helpful?

Maybe check if getMissionOptions returns?

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

 1A100.png?format=1500w  

Virtual CVW-8 - The mission of Virtual Carrier Air Wing EIGHT is to provide its members with an organization committed to presenting an authentic representation of U.S. Navy Carrier Air Wing operations in training and combat environments based on the real world experience of its real fighter pilots, air intercept controllers, airbosses, and many others.

 

Link to comment
Share on other sites

19 minuti fa, MARLAN_ ha scritto:

Are any of these related functions helpful?

Maybe check if getMissionOptions returns?

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

The first doesn't work cause you have the result in both environment. The latter is ok... but it works only once the mission is started, while I need it to work at DCS launch (even if I'm considering to evaluate if it's possible to move that block of code at mission start... but it's really complex and it might not work)


Edited by chromium

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

1 ora fa, chromium ha scritto:

Uhm just read this in the API, I'll try:

  • DCS.getLogHistory(from) -> {{abstime, level, subsystem, message}, ...}, last_index

    Returns last log messages starting from a given index.

    Usage:

      local logIndex = 0;
      local logHistory = {}
      logHistory, logIndex = DCS.getLogHistory(logIndex)

not working, cause it start logging when the code is loaded and not from start... and the command line is the 2nd

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

5 ore fa, Maverick87Shaka ha scritto:

Simple ( but dirty ) way that comes to my mind for a quick workaround, could be read the dcs.log
On second line you have all the arguments. its not 100% accurate since some people can mess the starting arguments, but it could be a starting point.

 

=== Log opened UTC 2022-11-01 13:00:50
2022-11-01 13:00:50.652 INFO    APP (Main): Command line: DCS.exe  --server --norender -w SyriaLiberation

 

 

seems not working, opening dcs.log file return nil cause it's already open.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

23 hours ago, chromium said:

Hi,

I'm looking urgently for a way to detect if DCS was launched in --server mode or if the was launched the dedicated server version, using anything in LuaHooks _G or in hooks environment, before launching the mission.

This is needed for DSMC mod, to detect if the user launching DCS have access to the options menù or not.


Check for a folder that does not exist in the dedicated installation!
You cannot, prior to a mission launch, use any line that asks if it is a server, those are mission and net environments. There's nothing in _G about that
🙂
https://stackoverflow.com/questions/1340230/check-if-directory-exists-in-lua


Edited by Pikey

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

29 minuti fa, Pikey ha scritto:

You cannot, prior to a mission launch, use any line that asks if it is a server, those are mission and net environments. There's nothing in _G about that

 

There was before 2.8, the panel_aircraft table was not available in dedi server. But, anyway, smart solution! I'll check if there are suitable folders for that check

i.e. the Folder 

main dir \DemoMods is not in Dedicated server

or 

saved games dir \Movies is not in Dedicated server

Is it the same for you?

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

22 hours ago, chromium said:

There was before 2.8, the panel_aircraft table was not available in dedi server. But, anyway, smart solution! I'll check if there are suitable folders for that check

i.e. the Folder 

main dir \DemoMods is not in Dedicated server

or 

saved games dir \Movies is not in Dedicated server

Is it the same for you?

I can confirm those folders are not in the Dedicated Server version of DCS (on my end).

Additionally, the:

saved games\ dir \Config\Input

saved games\ dir \ fxo

folders are not in my dedicated server instances.

 

This approach may cause issues for those running a regular DCS installation as a dedicated server and not the actual DCS Dedicated Server installation though, if that matters. (E.g. regular DCS Open Beta install with --server --norender)

Link to comment
Share on other sites

It's quite a weird use case for sure.

`This is needed for DSMC mod, to detect if the user launching DCS have access to the options menù or not. `
 

The fact that it was a requirement to be run before the mission executes in the plugin environment seems to me only be asking if the UI "could have" supported the options dialog boxes, not whether it was a server at mission runtime.

If my logic is flawed we can rethink, there is always more to these questions! 😄

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

18 minuti fa, Pikey ha scritto:

It's quite a weird use case for sure.

`This is needed for DSMC mod, to detect if the user launching DCS have access to the options menù or not. `
 

The fact that it was a requirement to be run before the mission executes in the plugin environment seems to me only be asking if the UI "could have" supported the options dialog boxes, not whether it was a server at mission runtime.

If my logic is flawed we can rethink, there is always more to these questions! 😄

Yep, but I decided as usual for the more complicate and long road, re-structuring the code to rework all w/o having to check before mission start. That might lead to a couple of other advantages also on the user end.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

1 ora fa, c0ff ha scritto:
local function is_norender()
    return DCS.getConfigValue("norender")
end

 

Thanks!!!!

  • Like 1

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Probably not the right place to ask, but... is it possibile to have a list of the config values that can be checked? thanks in advance 🙂

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

  • 4 weeks later...
On 11/9/2022 at 12:03 AM, chromium said:

Probably not the right place to ask, but... is it possibile to have a list of the config values that can be checked? thanks in advance 🙂

+1 for this

Click here for tutorials for using Virpil Hardware and Software

 

Click here for Virpil Flight equipment dimensions and pictures.

.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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