A few overlapping script fixes

See individual commits for details
- highlights are fixes for #876 and #887 as well as support for packing .exe files
Maybe we should encapsulate these private fields as well as the `GetScriptVariable` into a separate class for separation of the concerns.