NWScript is a proprietary scripting language and [[ISA|bytecode vm]] developed by Bioware originally for Neverwinter Knights. - Specification - [Documentation](https://xoreos.org/blog/2016/01/12/disassembling-nwscript-bytecode/) > NWScript is the scripting language and system [[BioWare]] introduced with _Neverwinter Nights_ and used, with improvements and changes, throughout the [[Aurora Engine|Aurora]]-based games \- via Xoreos (a reimplemention of Aurora) # Notability It is not just an interactive fiction language, it is a full scripting system. ## Implementations - Neverwinter Knights - Neverwinter Knights 2 - [[Knights of the Old Republic]] - Knights of the Old Republic II - The Sith Lords - Jade Empire - The Witcher (along with [[Lua]]) - Dragon Age: Origins - Dragon Age II # Script > NWScript is written in a [C](https://en.wikipedia.org/wiki/C_%28programming_language%29)-like language and saved with the .nss extension. A [compiler](https://en.wikipedia.org/wiki/Compiler) then translates it into a [stack](https://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29)-based [bytecode](https://en.wikipedia.org/wiki/Bytecode) with the .ncs extension, which is what the game executes. ## Types - `int` - 32-bit signed integer - `float` - 32-bit IEEE floating point - `string` - ASCII text - `object` - game world object reference - `event` - (depends on the game) - `effect` - (depends on the game) - `structs` - decomposed into individual variables in the bytecode - `vector` - decomposed into 3 `float`s - `action` - a script state or functor - `resource` - decomposed into `string` (added in DA:O) - `dynamic array` - a variable length array (added in DA:O) - `reference` - reference to a variable (added in DA:II) Note that there is no boolean type. NWScript uses `int` instead with the constants `TRUE` equaling `1` and `FALSE` equaling `0`. ## Engine Functions Functions provided by the game engine, outside of the script/vm. There are generally around 850 per game, with some that differ and some that are shared between each Aurora game. These include things like complex math, game object lookup, and interacting with game objects. # Instruction Set ## Complexity ## Features # History # Footnotes # References - [Old OSS OpenKnights Compiler for NSS and Tools](https://github.com/DrMcCoy/NWNTools) - [More Modern NSS Compiler and Tools](https://github.com/xoreos/xoreos-tools) - Old [KotOR Scripting Tool](https://deadlystream.com/files/file/191-kotor-scripting-tool-2021/) for NSS - KotOR 1 List of `actions` and constants [`nwscript.nss`](https://pastebin.com/Mty7bcJz) - KotOR 2 List of `actions` and constants [`nwscript.nss`](https://pastebin.com/HH7LjpSs) - https://deadlystream.com/topic/8168-ncs2nss-a-new-ncs-decompiler/ - https://github.com/lachjames/ncs2nss - https://jadeempire-modding.fandom.com/wiki/NSS_Files - https://nwn.wiki/display/NWN1/NWScript - https://czerka-rd.fandom.com/wiki/Nwscript.nss ## Tutorials - https://deadlystream.com/topic/6886-tutorial-kotor-modding-tutorial-series/ - http://www.nynaeve.net/Skywing/nwn2/Documentation/ncs.html