A command-line tool for extracting unique variables from .osc files (OMSI Script files) and generating variable list files.
The SimpleVarlistGenerator reads OMSI Script files (.osc), extracts unique variable names, and outputs them into separate text files. It distinguishes between:
- Written variables (S.L) - Variables that are written/set by the script
- Read variables (L.L) - Variables that are only read by the script
- Written string variables (S.$) - String variables that are written/set
- Read string variables (L.$) - String variables that are only read
- Extracts unique variable names from
.oscfiles - Categorizes variables by type (regular/string) and access mode (read/write)
- Prevents duplicate variables across multiple files
- Checks for duplicate variables in existing varlists
- Clean, formatted console output
- Clone the repository:
git clone https://github.com/f0xb17/SimpleVarlistGenerator
- Navigate to the project directory:
cd SimpleVarlistGenerator - Build the application:
go build -o simplevarlistgenerator .
GOOS=windows GOARCH=amd64 go build -o SimpleVarlistGenerator.exe .GOOS=darwin GOARCH=amd64 go build -o SimpleVarlistGenerator-macos-amd64 .GOOS=darwin GOARCH=arm64 go build -o SimpleVarlistGenerator-macos-arm64 .GOOS=linux GOARCH=amd64 go build -o SimpleVarlistGenerator-linux .GOOS=linux GOARCH=arm64 go build -o SimpleVarlistGenerator-linux-arm64 .# Windows
GOOS=windows GOARCH=amd64 go build -o SimpleVarlistGenerator.exe .
# macOS
GOOS=darwin GOARCH=amd64 go build -o SimpleVarlistGenerator-macos-amd64 .
GOOS=darwin GOARCH=arm64 go build -o SimpleVarlistGenerator-macos-arm64 .
# Linux
GOOS=linux GOARCH=amd64 go build -o SimpleVarlistGenerator-linux .
GOOS=linux GOARCH=arm64 go build -o SimpleVarlistGenerator-linux-arm64 .| Option | Description |
|---|---|
| (none) | Process all .osc files in current directory |
-f, --file <file.osc> |
Process a single file |
-c, --check [dir] |
Check varlists for duplicates (default: output) |
-h, --help |
Show help |
Process all .osc files in current directory:
./simplevarlistgeneratorProcess a single file:
./simplevarlistgenerator -f antrieb.oscCheck for duplicates in output directory:
./simplevarlistgenerator -cCheck a specific directory:
./simplevarlistgenerator -c /path/to/outputThe tool creates the following directory structure:
output/
├── varlist/
│ ├── antrieb_varlist.txt
│ ├── engine_varlist.txt
│ └── ...
└── stringvarlisten/
├── cockpit_stringvarlist.txt
└── ...
- output/varlist/: Contains regular variables (both S.L and L.L)
- output/stringvarlisten/: Contains string variables (both S.$ and L.$)
When processing files, the tool shows:
- [W]: Written variables (S.L) - Variables that are written by the script
- [S]: Written string variables (S.$) - String variables that are written
- [R]: Read-only variables (L.L and L.$) - Variables that are only read (informational)
============================================
Processing 26 OSC files
============================================
[W] antrieb. variables (S.Losc: 28)
[S] cockpit.osc: 1 string variables (S.$)
[R] cockpit.osc: 167 variables (L.L) | 0 string variables (L.$)
============================================
Total Written Variables (S.L): 245
Total Written String Vars (S.$): 12
Total Read Variables (L.L): 189
Total Read String Vars (L.$): 5
============================================
The -c option scans all varlist files and reports:
- Duplicates WITHIN files: Variables that appear multiple times in a single file
- Duplicates ACROSS files: Variables that appear in more than one file
Example:
=== Varlist Check Report ===
Files checked: 28
--- Duplicates ACROSS files ---
engine_on found in:
- G81_main_varlist.txt
- antrieb_varlist.txt
Total duplicates: 3
OMSI Script uses the following prefixes:
| Prefix | Meaning |
|---|---|
(S.L.variable) |
Local variable - written by the script |
(L.L.variable) |
Global variable - read from memory |
(S.$.variable) |
Local string variable - written by the script |
(L.$.variable) |
Global string variable - read from memory |
SimpleVarlistGenerator/
├── go.mod
├── main.go
├── oscextract/
│ └── extract.go
├── varlistcreator/
│ └── writer.go
├── checkvarlist/
│ └── check.go
└── output/
├── varlist/
└── stringvarlisten/
Contributions are welcome! Please feel free to submit a pull request or raise an issue.