ConfSE is an experimental Oblivion Script Extender (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++ 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:
- Oblivion Script Extender as the targeted OBSE version
- JSON for Modern C++ 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.
The repository has all its dependencies linked as Git submodules, so they need to be fetched when cloning, as well:
git clone --recurse-submodules https://github.com/surilindur/confse
Any changes can then be made, and building the plugin should be possible via
msbuild confse/confse.vcxproj -p:BuildInParallel=true
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
Please feel free to report any issues on the GitHub issue tracker.
This code is copyrighted and released under the MIT license.