https://github.com/surilindur/confse
ConfSE is an Oblivion Script Extender (OBSE) plugin that aims to enable the use of JSON to save and load data
https://github.com/surilindur/confse
elder-scrolls json oblivion obse
Last synced: about 1 year ago
JSON representation
ConfSE is an Oblivion Script Extender (OBSE) plugin that aims to enable the use of JSON to save and load data
- Host: GitHub
- URL: https://github.com/surilindur/confse
- Owner: surilindur
- License: mit
- Created: 2017-03-11T23:54:26.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-10-05T14:12:27.000Z (over 1 year ago)
- Last Synced: 2025-04-12T05:52:04.373Z (about 1 year ago)
- Topics: elder-scrolls, json, oblivion, obse
- Language: C++
- Homepage:
- Size: 334 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**ConfSE** is an experimental [Oblivion Script Extender](https://github.com/llde/xOBSE) (OBSE) plugin
that aims to enable the loading and saving of JSON files from within Oblivion scripts.
This is accomplished through the use of OBSE's `array_var` data type, that be either an array or map.
The plugin uses [an existing JSON library for C++](https://github.com/nlohmann/json)
together with some simple Oblivion-specific type conversions.
The following type conversions are performed.
| Oblivion | JSON | Notes |
|:--------------------------------|:------------------------|:-----------------------------------------------------|
| `array_var` array | `[]` | Uninitialized saved as `null` |
| `array_var` map | `{}` | Uninitialized saved as `null` |
| `string_var` | String | Uninitialized saved as `null` |
| `ref` | `"plugin.esp:00000000"` | Unbound is saved as `null` |
| `short`, `int`, `long`, `float` | Number | Each value gets loaded as the smallest possible type |
The design goal of the plugin is to offer a straightforward mapping from OBSE's `array_var`s,
including nested ones,
to a corresponding JSON strcture and vice versa.
**This is a work-in-progress thing and is NOT intended for use. At the moment, it does not even compile.**
This project depends on the following external projects and libraries:
* [llde/xOBSE](https://github.com/llde/xOBSE) as the targeted OBSE version
* [nlohmann/json](https://github.com/nlohmann/json) as the JSON library used to load and save files
* MSBuild for building the plugin project
The latest compiled DLL at a given time should be available from the GitHub Actions artifacts for the CI workflow.
## Development Setup
The repository has all its dependencies linked as Git submodules, so they need to be fetched when cloning, as well:
```bash
git clone --recurse-submodules https://github.com/surilindur/confse
```
Any changes can then be made, and building the plugin should be possible via
```bash
msbuild confse/confse.vcxproj -p:BuildInParallel=true
```
## Added Script Commands
The following new commands are added by the plugin to load JSON:
**JsonLoadFile** - attempts to load the contents of the specified file as JSON, returning the result as an `array_var`. When loading fails, returns either the `array_var` passed as `default` or an uninitialized value.
(array_var) JsonLoadFile filename:string_var default:array_var
**JsonLoadString** - attempts to load the contents of the provided `string_var` as JSON, returning the result as an `array_var`. When loading fails, returns either the `array_var` passed as `default` or an uninitialized value.
(array_var) JsonLoadString data:string_var default:array_var
**JsonSaveFile** - attempts to serialize the provided `array_var` to the specificed file as JSON, returning `0` after success or `-1` if an error occurred.
(status:int) JsonSaveFile data:array_var filename:string_var
**JsonSaveString** - attempts to serialize the provided `array_var` as a string, returning a `string_var` that will either contain the resulting string or be uninitialized if an error occurred.
(string_var) JsonSaveString data:array_var
## Issues
Please feel free to report any issues on the GitHub issue tracker.
## License
This code is copyrighted and released under the [MIT license](http://opensource.org/licenses/MIT).