dcszap


Namedcszap JSON
Version 0.4.3 PyPI version JSON
download
home_page
SummaryDCS-BIOS client to automate aircraft setup
upload_time2023-10-31 00:11:37
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Jack Deeth Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dcs dcsworld digital-combat-simulator automation flightsim
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DCSZap

This is a minimal DCS-BIOS client to automate setting aircraft controls from
text files.

Version 0.4.3

## Installation

1. Install any recent Python 3 version (3.7 or later)
2. Install [the FlightPanels/Skunkworks fork of DCS-BIOS](https://github.com/DCS-Skunkworks/dcs-bios)
3. Download [Bort](https://github.com/DCS-Skunkworks/Bort/releases) to assist with writing your own scripts
4. Copy the [example script](https://github.com/JDeeth/DCSZap/tree/main/example)  to `%USERPROFILE%/Saved Games/DCSZap` - create this folder alongside your DCS settings folder
5. From the command prompt/terminal:
    ```
    pip install dcszap
    ```

## Usage

From the command prompt/terminal:
```
dcszap
```

You will be given a list of scripts (`.txt` files in the scripts directory):
```
$ dcszap
Scripts located in C:/Users/YourNameHere/Saved Games/DCSZap:
 1 Mi8_Preflight                   Mi-8 preflight
 2 Mi8_ArmGunpods                  Mi-8 set up gunpods
 3 SA342M_Preflight                Gazelle SA342M preflight
>
```
Type the number of the script you want to run and press Enter to run.

The commands are sent to DCS-BIOS over a network socket - the DCS window
does not need to be in focus for the scripts to work. Some modules may
require you to be in the aircraft cockpit.

You'll see the commands on the screen as they run:
```
> 3
TABLET_PW                   TOGGLE          Tablet                       Off
TABLET_SHOW                 TOGGLE          Tablet                       Stow
PANEL_LIGHTING              1               Panel lighting               On
DASHBOARD_LIGHTING          3276            Backlight brightness         Set 5%
...
FLARE_DISP_FIRE_CAP         1               Flare dispense switch cover  Open
WEAPONS_MASTER_ARM          1               Master arm                   On
ANTICOLL_LIGHTS             1               Anticollision lights         Off
Script complete!
```
You can then start another script. Enter nothing or `Ctrl-C` to quit.

## Options

To use scripts stored in a location other than `%USERPROFILE%/Saved Games/DCSZap`:
```
dcszap --scripts your/scripts/directory
```

If DCS is running on a different computer, or if DCS-BIOS isn't using port 7778:
```
dcszap --host 192.168.123.45 --port 24601
```

To suppress messages while the script is running:
```
dcszap --quiet
```

For a full description:
```
dcszap --help
```

## Scripts

Scripts are text files:

```
script SA342M_Preflight
description Gazelle SA342M Preflight
interval 0.3

set PANEL_LIGHTING 1            # Instrument backlighting: On
set DASHBOARD_LIGHTING 0.05     # Backlight brightness: Set 5%
pause 0.8
set TV_ON_OFF 1                 # Viviane TV: On
```

The first lines set the name and description for the script, and optionally the
interval between commands in seconds. If not specified, the interval is 0.2
seconds.

The remainder of the file is `set` and `pause` commands and comments.

`set` is for sending DCS-BIOS commands:
```
set PANEL_LIGHTING 1
```
This sends the argument `1` to the DCS-BIOS identifier `PANEL_LIGHTING` - which
in the Gazelle turns on the instrument backlighting.

End-of-line comments start with `#`. The script will split the comment on `:`
and display them in two columns.

Arguments that look like floating-point numbers - `0.25` say - are converted
into an integer between 0 and 65535. `0.0` becomes 0 and `1.0` becomes 65535.

`pause` adds a delay between two actions, in addition to the normal interval.

Lines which don't begin with `script`, `description`, `interval`, `set` or `pause`
are ignored and can be used for comments.

## Writing scripts

 - Launch your favourite DCS module
 - Open Bort
 - Find the controls you always find yourself using at the start of every flight
 - Operate the controls in DCS and see the values change in Bort
 - Operate the controls in Bort and see them move in DCS
 - Write the control identifiers and the desired values into your own script file (a `.txt` file in the DCSZap scripts folder)
 - Optionally include comments to describe the intent, e.g. that setting the radar alt bug to 2215 corresponds to 10 meters.
 - Save your script and run `dcszap`
 - Run your script
 - See the controls move!

For controls like instrument brightness knobs which take a number between
0 and 65535 representing 0% to 100%, you can enter the value as a floating
point number. DCSZap converts these into into integers - `0.0` to `0`, `1.0`
to `65535`.

Presently the scripts are loaded into memory at the time they are displayed
for selection, so if you've edited a script with DCSZap waiting for a selection
and then you run it, you'll run the old version. To reload the list, enter a
number that doesn't correspond to any script e.g. 0.

For more guidance on DCS-BIOS commands, please see:
- [the DCS-BIOS documentation](https://github.com/DCS-Skunkworks/dcs-bios/blob/master/Scripts/DCS-BIOS/doc/developerguide.adoc#the-dcs-bios-import-protocol)
- [the DCS-BIOS source code for the aircraft module](https://github.com/DCS-Skunkworks/dcs-bios/tree/master/Scripts/DCS-BIOS/lib/modules/aircraft_modules)
- [the DCS-BIOS Module Lua class](https://github.com/DCS-Skunkworks/dcs-bios/blob/master/Scripts/DCS-BIOS/lib/modules/Module.lua)

## Contributing

If you'd like your script to be included as an example, please let me know
(via an issue, pull request, Discord, or forum) and I'd be delighted to
include it with attribution. Ideas, bugfixes, pull requests etc are all welcome too.

## Next steps

This project is likely to develop rapidly and the script format could change
in the near future. In particular I'd like to go further with expressing
scripts in human language e.g. `Landing lights: Extend` rather than
`set LANDING_LIGHT 2`, with a translation layer between how the controls are
labelled to the virtual pilot and the identifiers and values used in DCS-BIOS.

- command line option to specify a specific script rather than select from directory, allowing the script to run completely silent
- load scripts on selection, not when the selection list is displayed
- more obvious selection list reload action
- Make the tests better, largely for the sake of better tests
- 2-way comms with DCS-BIOS to, e.g., select a script automatically on loading
  a module, start scripts from within DCS…
- more example scripts!

## Related projects

With thanks to SlipHavoc for [DCSAutoMate](https://github.com/SlipHavoc/DCSAutoMate), the inspiration for this project.
DCSAutoMate includes the ability to simulate keypresses to carry out actions
unavailable via DCS-BIOS, and is driven from Python scripts, which gives a
great deal of additional flexibility. I wanted to make a system which is more
lightweight, which can be installed and run without auto-py-to-exe or much
Python expertise.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dcszap",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "DCS,DCSWorld,digital-combat-simulator,automation,flightsim",
    "author": "",
    "author_email": "Jack Deeth <developer@jackdeeth.org.uk>",
    "download_url": "https://files.pythonhosted.org/packages/58/c9/963783d0019664ca8aed6e1a822b66379f9835564db81cbe2f2ec89d6a4c/dcszap-0.4.3.tar.gz",
    "platform": null,
    "description": "# DCSZap\r\n\r\nThis is a minimal DCS-BIOS client to automate setting aircraft controls from\r\ntext files.\r\n\r\nVersion 0.4.3\r\n\r\n## Installation\r\n\r\n1. Install any recent Python 3 version (3.7 or later)\r\n2. Install [the FlightPanels/Skunkworks fork of DCS-BIOS](https://github.com/DCS-Skunkworks/dcs-bios)\r\n3. Download [Bort](https://github.com/DCS-Skunkworks/Bort/releases) to assist with writing your own scripts\r\n4. Copy the [example script](https://github.com/JDeeth/DCSZap/tree/main/example)  to `%USERPROFILE%/Saved Games/DCSZap` - create this folder alongside your DCS settings folder\r\n5. From the command prompt/terminal:\r\n    ```\r\n    pip install dcszap\r\n    ```\r\n\r\n## Usage\r\n\r\nFrom the command prompt/terminal:\r\n```\r\ndcszap\r\n```\r\n\r\nYou will be given a list of scripts (`.txt` files in the scripts directory):\r\n```\r\n$ dcszap\r\nScripts located in C:/Users/YourNameHere/Saved Games/DCSZap:\r\n 1 Mi8_Preflight                   Mi-8 preflight\r\n 2 Mi8_ArmGunpods                  Mi-8 set up gunpods\r\n 3 SA342M_Preflight                Gazelle SA342M preflight\r\n>\r\n```\r\nType the number of the script you want to run and press Enter to run.\r\n\r\nThe commands are sent to DCS-BIOS over a network socket - the DCS window\r\ndoes not need to be in focus for the scripts to work. Some modules may\r\nrequire you to be in the aircraft cockpit.\r\n\r\nYou'll see the commands on the screen as they run:\r\n```\r\n> 3\r\nTABLET_PW                   TOGGLE          Tablet                       Off\r\nTABLET_SHOW                 TOGGLE          Tablet                       Stow\r\nPANEL_LIGHTING              1               Panel lighting               On\r\nDASHBOARD_LIGHTING          3276            Backlight brightness         Set 5%\r\n...\r\nFLARE_DISP_FIRE_CAP         1               Flare dispense switch cover  Open\r\nWEAPONS_MASTER_ARM          1               Master arm                   On\r\nANTICOLL_LIGHTS             1               Anticollision lights         Off\r\nScript complete!\r\n```\r\nYou can then start another script. Enter nothing or `Ctrl-C` to quit.\r\n\r\n## Options\r\n\r\nTo use scripts stored in a location other than `%USERPROFILE%/Saved Games/DCSZap`:\r\n```\r\ndcszap --scripts your/scripts/directory\r\n```\r\n\r\nIf DCS is running on a different computer, or if DCS-BIOS isn't using port 7778:\r\n```\r\ndcszap --host 192.168.123.45 --port 24601\r\n```\r\n\r\nTo suppress messages while the script is running:\r\n```\r\ndcszap --quiet\r\n```\r\n\r\nFor a full description:\r\n```\r\ndcszap --help\r\n```\r\n\r\n## Scripts\r\n\r\nScripts are text files:\r\n\r\n```\r\nscript SA342M_Preflight\r\ndescription Gazelle SA342M Preflight\r\ninterval 0.3\r\n\r\nset PANEL_LIGHTING 1            # Instrument backlighting: On\r\nset DASHBOARD_LIGHTING 0.05     # Backlight brightness: Set 5%\r\npause 0.8\r\nset TV_ON_OFF 1                 # Viviane TV: On\r\n```\r\n\r\nThe first lines set the name and description for the script, and optionally the\r\ninterval between commands in seconds. If not specified, the interval is 0.2\r\nseconds.\r\n\r\nThe remainder of the file is `set` and `pause` commands and comments.\r\n\r\n`set` is for sending DCS-BIOS commands:\r\n```\r\nset PANEL_LIGHTING 1\r\n```\r\nThis sends the argument `1` to the DCS-BIOS identifier `PANEL_LIGHTING` - which\r\nin the Gazelle turns on the instrument backlighting.\r\n\r\nEnd-of-line comments start with `#`. The script will split the comment on `:`\r\nand display them in two columns.\r\n\r\nArguments that look like floating-point numbers - `0.25` say - are converted\r\ninto an integer between 0 and 65535. `0.0` becomes 0 and `1.0` becomes 65535.\r\n\r\n`pause` adds a delay between two actions, in addition to the normal interval.\r\n\r\nLines which don't begin with `script`, `description`, `interval`, `set` or `pause`\r\nare ignored and can be used for comments.\r\n\r\n## Writing scripts\r\n\r\n - Launch your favourite DCS module\r\n - Open Bort\r\n - Find the controls you always find yourself using at the start of every flight\r\n - Operate the controls in DCS and see the values change in Bort\r\n - Operate the controls in Bort and see them move in DCS\r\n - Write the control identifiers and the desired values into your own script file (a `.txt` file in the DCSZap scripts folder)\r\n - Optionally include comments to describe the intent, e.g. that setting the radar alt bug to 2215 corresponds to 10 meters.\r\n - Save your script and run `dcszap`\r\n - Run your script\r\n - See the controls move!\r\n\r\nFor controls like instrument brightness knobs which take a number between\r\n0 and 65535 representing 0% to 100%, you can enter the value as a floating\r\npoint number. DCSZap converts these into into integers - `0.0` to `0`, `1.0`\r\nto `65535`.\r\n\r\nPresently the scripts are loaded into memory at the time they are displayed\r\nfor selection, so if you've edited a script with DCSZap waiting for a selection\r\nand then you run it, you'll run the old version. To reload the list, enter a\r\nnumber that doesn't correspond to any script e.g. 0.\r\n\r\nFor more guidance on DCS-BIOS commands, please see:\r\n- [the DCS-BIOS documentation](https://github.com/DCS-Skunkworks/dcs-bios/blob/master/Scripts/DCS-BIOS/doc/developerguide.adoc#the-dcs-bios-import-protocol)\r\n- [the DCS-BIOS source code for the aircraft module](https://github.com/DCS-Skunkworks/dcs-bios/tree/master/Scripts/DCS-BIOS/lib/modules/aircraft_modules)\r\n- [the DCS-BIOS Module Lua class](https://github.com/DCS-Skunkworks/dcs-bios/blob/master/Scripts/DCS-BIOS/lib/modules/Module.lua)\r\n\r\n## Contributing\r\n\r\nIf you'd like your script to be included as an example, please let me know\r\n(via an issue, pull request, Discord, or forum) and I'd be delighted to\r\ninclude it with attribution. Ideas, bugfixes, pull requests etc are all welcome too.\r\n\r\n## Next steps\r\n\r\nThis project is likely to develop rapidly and the script format could change\r\nin the near future. In particular I'd like to go further with expressing\r\nscripts in human language e.g. `Landing lights: Extend` rather than\r\n`set LANDING_LIGHT 2`, with a translation layer between how the controls are\r\nlabelled to the virtual pilot and the identifiers and values used in DCS-BIOS.\r\n\r\n- command line option to specify a specific script rather than select from directory, allowing the script to run completely silent\r\n- load scripts on selection, not when the selection list is displayed\r\n- more obvious selection list reload action\r\n- Make the tests better, largely for the sake of better tests\r\n- 2-way comms with DCS-BIOS to, e.g., select a script automatically on loading\r\n  a module, start scripts from within DCS\u2026\r\n- more example scripts!\r\n\r\n## Related projects\r\n\r\nWith thanks to SlipHavoc for [DCSAutoMate](https://github.com/SlipHavoc/DCSAutoMate), the inspiration for this project.\r\nDCSAutoMate includes the ability to simulate keypresses to carry out actions\r\nunavailable via DCS-BIOS, and is driven from Python scripts, which gives a\r\ngreat deal of additional flexibility. I wanted to make a system which is more\r\nlightweight, which can be installed and run without auto-py-to-exe or much\r\nPython expertise.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Jack Deeth  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "DCS-BIOS client to automate aircraft setup",
    "version": "0.4.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/JDeeth/DCSZap/issues",
        "Homepage": "https://github.com/JDeeth/DCSZap"
    },
    "split_keywords": [
        "dcs",
        "dcsworld",
        "digital-combat-simulator",
        "automation",
        "flightsim"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44263ea79c5002db9bd2dafe24980bf5fe479dcd0a0e43781bcbe8e5cf1d7170",
                "md5": "5c2ab0ccbee8962a2157b4a167562f9d",
                "sha256": "b4f963ac9030d6622d0a9d976fd76dfc00522fd5b4a56a98d8af66a203e052b2"
            },
            "downloads": -1,
            "filename": "dcszap-0.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c2ab0ccbee8962a2157b4a167562f9d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8040,
            "upload_time": "2023-10-31T00:11:34",
            "upload_time_iso_8601": "2023-10-31T00:11:34.910035Z",
            "url": "https://files.pythonhosted.org/packages/44/26/3ea79c5002db9bd2dafe24980bf5fe479dcd0a0e43781bcbe8e5cf1d7170/dcszap-0.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58c9963783d0019664ca8aed6e1a822b66379f9835564db81cbe2f2ec89d6a4c",
                "md5": "9c8e6241c94f50745f3730d4bdf16ac3",
                "sha256": "e5b30f7b979018b3c4ce9fac4c31d019f223ded4e1a0167d2e006a74877a3d9a"
            },
            "downloads": -1,
            "filename": "dcszap-0.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9c8e6241c94f50745f3730d4bdf16ac3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 8495,
            "upload_time": "2023-10-31T00:11:37",
            "upload_time_iso_8601": "2023-10-31T00:11:37.574127Z",
            "url": "https://files.pythonhosted.org/packages/58/c9/963783d0019664ca8aed6e1a822b66379f9835564db81cbe2f2ec89d6a4c/dcszap-0.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-31 00:11:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JDeeth",
    "github_project": "DCSZap",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dcszap"
}
        
Elapsed time: 0.13178s