framework: incorporate .37 nwnx availability check and error reporting into event script registration process #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The most recent stable (.37-14+) has incorporated NWNX called directly into
nwscript.nss. This change carries with it a complete script abort if nwnx is called, but not available. Therefore, during the script registration process, if an nwnx event script is registered and nwnx is not currently running, as may be the case with local testing, the entire library script that is attempting to register that event will be aborted.There is expected to be a ruleset toggle that prevent this behavior and allows the script to continue while providing an error, however, the toggle will default to script abort, which means we need to take the most conservative route and ensure our libraries aren't aborted because of the lack of nwnx availability.
In addition to the check, an error message is provided to ensure the user understands exactly why the script was not registered.
I didn't swe a threat in
hook_nwnxthat would require this change to be incorporated there since it's only run via NWNX orExecuteScriptfrom the framework after the availability check, so worst case, it would simply fail with a transmitted error. However, if youw want full coverage,hook_nwnxmay also be modified to include this check.With this change, .37-14+ is the required minimum game version for the framework.