





🌟 Special thanks to our amazing supporters:
✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Arch Toasty][Benedikt][David Martínez Martí]
Hello friends! How have you been doing? The Beamdog team has been hard at work on the next Neverwinter Nights: Enhanced Edition patch! Today, we are shipping release 8193.31 to the development branch of NWN:EE. This is a huge beta patch, with many new and exciting features. We appreciate your assistance in helping us test them, and reporting any/all issues you find.
int GUIEVENT_COMPASS_CLICK = 15;
int GUIEVENT_LEVELUP_CANCELLED = 16;
int GUIEVENT_AREA_LOADSCREEN_FINISHED = 17;
int GUIEVENT_QUICKCHAT_ACTIVATE = 18;
int GUIEVENT_QUICKCHAT_SELECT = 19;
int GUIEVENT_QUICKCHAT_CLOSE = 20;
int GUIEVENT_SELECT_CREATURE = 21;
int GUIEVENT_UNSELECT_CREATURE = 22;
int GUIEVENT_EXAMINE_OBJECT = 23;
int GUIEVENT_OPTIONS_OPEN = 24;
int GUIEVENT_OPTIONS_CLOSE = 25;
int JSON_TYPE_NULL = 0; // Also invalid
int JSON_TYPE_OBJECT = 1;
int JSON_TYPE_ARRAY = 2;
int JSON_TYPE_STRING = 3;
int JSON_TYPE_INTEGER = 4;
int JSON_TYPE_FLOAT = 5;
int JSON_TYPE_BOOL = 6;
// The player's gui width (inner window bounds).
string PLAYER_DEVICE_PROPERTY_GUI_WIDTH = "gui_width";
// The player's gui height (inner window bounds).
string PLAYER_DEVICE_PROPERTY_GUI_HEIGHT = "gui_height";
// The player's gui scale, in percent (factor 1.4 = 140)
string PLAYER_DEVICE_PROPERTY_GUI_SCALE = "gui_scale";
int PLAYER_LANGUAGE_INVALID = -1;
int PLAYER_LANGUAGE_ENGLISH = 0;
int PLAYER_LANGUAGE_FRENCH = 1;
int PLAYER_LANGUAGE_GERMAN = 2;
int PLAYER_LANGUAGE_ITALIAN = 3;
int PLAYER_LANGUAGE_SPANISH = 4;
int PLAYER_LANGUAGE_POLISH = 5;
int PLAYER_DEVICE_PLATFORM_INVALID = 0;
int PLAYER_DEVICE_PLATFORM_WINDOWS_X86 = 1;
int PLAYER_DEVICE_PLATFORM_WINDOWS_X64 = 2;
int PLAYER_DEVICE_PLATFORM_LINUX_X86 = 10;
int PLAYER_DEVICE_PLATFORM_LINUX_X64 = 11;
int PLAYER_DEVICE_PLATFORM_LINUX_ARM32 = 12;
int PLAYER_DEVICE_PLATFORM_LINUX_ARM64 = 13;
int PLAYER_DEVICE_PLATFORM_MAC_X86 = 20;
int PLAYER_DEVICE_PLATFORM_MAC_X64 = 21;
int PLAYER_DEVICE_PLATFORM_IOS = 30;
int PLAYER_DEVICE_PLATFORM_ANDROID_ARM32 = 40;
int PLAYER_DEVICE_PLATFORM_ANDROID_ARM64 = 41;
int PLAYER_DEVICE_PLATFORM_ANDROID_X64 = 42;
int PLAYER_DEVICE_PLATFORM_NINTENDO_SWITCH = 50;
int PLAYER_DEVICE_PLATFORM_MICROSOFT_XBOXONE = 60;
int PLAYER_DEVICE_PLATFORM_SONY_PS4 = 70;
int RESTYPE_RES = 0;
...
int RESTYPE_CAF = 2082;
// Parse the given string as a valid json value, and returns the corresponding type.
// Returns a JSON_TYPE_NULL on error.
// Check JsonGetError() to see the parse error, if any.
// NB: The parsed string needs to be in game-local encoding, but the generated json structure
// will contain UTF-8 data.
json JsonParse(string sJson);
// Dump the given json value into a string that can be read back in via JsonParse.
// nIndent describes the indentation level for pretty-printing; a value of -1 means no indentation and no linebreaks.
// Returns a string describing JSON_TYPE_NULL on error.
// NB: The dumped string is in game-local encoding, with all non-ascii characters escaped.
string JsonDump(json jValue, int nIndent = -1);
// Describes the type of the given json value.
// Returns JSON_TYPE_NULL if the value is empty.
int JsonGetType(json jValue);
// Returns the length of the given json type.
// For objects, returns the number of top-level keys present.
// For arrays, returns the number of elements.
// Null types are of size 0.
// All other types return 1.
int JsonGetLength(json jValue);
// Returns the error message if the value has errored out.
// Currently only describes parse errors.
string JsonGetError(json jValue);
// Create a NULL json value, seeded with a optional error message for JsonGetError().
json JsonNull(string sError = "");
// Create a empty json object.
json JsonObject();
// Create a empty json array.
json JsonArray();
// Create a json string value.
// NB: Strings are encoded to UTF-8 from the game-local charset.
json JsonString(string sValue);
// Create a json integer value.
json JsonInt(int nValue);
// Create a json floating point value.
json JsonFloat(float fValue);
// Create a json bool valye.
json JsonBool(int bValue);
// Returns a string representation of the json value.
// Returns "" if the value cannot be represented as a string, or is empty.
// NB: Strings are decoded from UTF-8 to the game-local charset.
string JsonGetString(json jValue);
// Returns a int representation of the json value, casting where possible.
// Returns 0 if the value cannot be represented as a float.
// Use this to parse json bool types.
// NB: This will narrow down to signed 32 bit, as that is what NWScript int is.
// If you are trying to read a 64 bit or unsigned integer, you will lose data.
// You will not lose data if you keep the value as a json element (via Object/ArrayGet).
int JsonGetInt(json jValue);
// Returns a float representation of the json value, casting where possible.
// Returns 0.0 if the value cannot be represented as a float.
// NB: This will narrow doubles down to float.
// If you are trying to read a double, you will lose data.
// You will not lose data if you keep the value as a json element (via Object/ArrayGet).
float JsonGetFloat(json jValue);
// Returns a json array containing all keys of jObject.
// Returns a empty array if the object is empty or not a json object, with GetJsonError() filled in.
json JsonObjectKeys(json jObject);
// Returns the key value of sKey on the object jObect.
// Returns a null json value if jObject is not a object or sKey does not exist on the object, with GetJsonError() filled in.
json JsonObjectGet(json jObject, string sKey);
// Returns a modified copy of jObject with the key at sKey set to jValue.
// Returns a json null value if jObject is not a object, with GetJsonError() filled in.
json JsonObjectSet(json jObject, string sKey, json jValue);
// Returns a modified copy of jObject with the key at sKey deleted.
// Returns a json null value if jObject is not a object, with GetJsonError() filled in.
json JsonObjectDel(json jObject, string sKey);
// Gets the json object at jArray index position nIndex.
// Returns a json null value if the index is out of bounds, with GetJsonError() filled in.
json JsonArrayGet(json jArray, int nIndex);
// Returns a modified copy of jArray with position nIndex set to jValue.
// Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
// Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
json JsonArraySet(json jArray, int nIndex, json jValue);
// Returns a modified copy of jArray with jValue inserted at position nIndex.
// All succeeding objects in the array will move by one.
// By default (-1), inserts objects at the end of the array ("push").
// nIndex = 0 inserts at the beginning of the array.
// Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
// Returns a json null value if nIndex is not 0 or -1 and out of bounds, with GetJsonError() filled in.
json JsonArrayInsert(json jArray, json jValue, int nIndex = -1);
// Returns a modified copy of jArray with the element at position nIndex removed,
// and the array resized by one.
// Returns a json null value if jArray is not actually an array, with GetJsonError() filled in.
// Returns a json null value if nIndex is out of bounds, with GetJsonError() filled in.
json JsonArrayDel(json jArray, int nIndex);
// Transforms the given object into a json structure.
// The json format is compatible with what https://github.com/niv/neverwinter.nim@1.4.3+ emits.
// Returns the null json type on errors, or if oObject is not serializable, with GetJsonError() filled in.
// Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
// If bSaveObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are saved out
// (except for Combined Area Format, which always has object state saved out).
json ObjectToJson(object oObject, int bSaveObjectState = FALSE);
// Deserializes the game object described in jObject.
// Returns OBJECT_INVALID on errors.
// Supported object types: creature, item, trigger, placeable, door, waypoint, encounter, store, area (combined format)
// For areas, locLocation is ignored.
// If bLoadObjectState is TRUE, local vars, effects, action queue, and transition info (triggers, doors) are read in.
object JsonToObject(json jObject, location locLocation, object oOwner = OBJECT_INVALID, int bLoadObjectState = FALSE);
// Returns the element at the given JSON pointer value.
// See https://datatracker.ietf.org/doc/html/rfc6901 for details.
// Returns a json null value on error, with GetJsonError() filled in.
json JsonPointer(json jData, string sPointer);
// Return a modified copy of jData with jValue inserted at the path described by sPointer.
// See https://datatracker.ietf.org/doc/html/rfc6901 for details.
// Returns a json null value on error, with GetJsonError() filled in.
// jPatch is an array of patch elements, each containing a op, a path, and a value field. Example:
// [
// { "op": "replace", "path": "/baz", "value": "boo" },
// { "op": "add", "path": "/hello", "value": ["world"] },
// { "op": "remove", "path": "/foo"}
// ]
// Valid operations are: add, remove, replace, move, copy, test
json JsonPatch(json jData, json jPatch);
// Returns the diff (described as a json structure you can pass into JsonPatch) between the two objects.
// Returns a json null value on error, with GetJsonError() filled in.
json JsonDiff(json jLHS, json jRHS);
// Returns a modified copy of jData with jMerge merged into it. This is an alternative to
// JsonPatch/JsonDiff, with a syntax more closely resembling the final object.
// See https://datatracker.ietf.org/doc/html/rfc7386 for details.
// Returns a json null value on error, with GetJsonError() filled in.
json JsonMerge(json jData, json jMerge);
// Get oObject's local json variable sVarName
// * Return value on error: json null type
json GetLocalJson(object oObject, string sVarName);
// Set oObject's local json variable sVarName to jValue
void SetLocalJson(object oObject, string sVarName, json jValue);
// Delete oObject's local json variable sVarName
void DeleteLocalJson(object oObject, string sVarName);
// Bind an json to a named parameter of the given prepared query.
// Json values are serialised into a string.
// Example:
// sqlquery v = SqlPrepareQueryObject(GetModule(), "insert into test (col) values (@myjson);");
// SqlBindJson(v, "@myjson", myJsonObject);
// SqlStep(v);
void SqlBindJson(sqlquery sqlQuery, string sParam, json jValue);
// Retrieve a column cast as a json value of the currently stepped row.
// You can call this after SqlStep() returned TRUE.
// In case of error, a json null value will be returned.
// In traditional fashion, nIndex starts at 0.
json SqlGetJson(sqlquery sqlQuery, int nIndex);
// This stores a json out to the specified campaign database
// The database name:
// - is case insensitive and it must be the same for both set and get functions.
// - can only contain alphanumeric characters, no spaces.
// The var name must be unique across the entire database, regardless of the variable type.
// If you want a variable to pertain to a specific player in the game, provide a player object.
void SetCampaignJson(string sCampaignName, string sVarName, json jValue, object oPlayer=OBJECT_INVALID);
// This will read a json from the specified campaign database
// The database name:
// - is case insensitive and it must be the same for both set and get functions.
// - can only contain alphanumeric characters, no spaces.
// The var name must be unique across the entire database, regardless of the variable type.
// If you want a variable to pertain to a specific player in the game, provide a player object.
json GetCampaignJson(string sCampaignName, string sVarName, object oPlayer=OBJECT_INVALID);
// Gets a device property/capability as advertised by the client.
// sProperty is one of PLAYER_DEVICE_PROPERTY_xxx.
// Returns -1 if
// - the property was never set by the client,
// - the the actual value is -1,
// - the player is running a older build that does not advertise device properties,
// - the player has disabled sending device properties (Options->Game->Privacy).
int GetPlayerDeviceProperty(object oPlayer, string sProperty);
// Returns the LANGUAGE_xx code of the given player, or -1 if unavailable.
int GetPlayerLanguage(object oPlayer);
// Returns one of PLAYER_DEVICE_PLATFORM_xxx, or 0 if unavailable.
int GetPlayerDevicePlatform(object oPlayer);
// Deserializes the given resref/template into a JSON structure.
// Supported GFF resource types:
// * RESTYPE_CAF (and RESTYPE_ARE, RESTYPE_GIT, RESTYPE_GIC)
// * RESTYPE_UTC
// * RESTYPE_UTI
// * RESTYPE_UTT
// * RESTYPE_UTP
// * RESTYPE_UTD
// * RESTYPE_UTW
// * RESTYPE_UTE
// * RESTYPE_UTM
// Returns a valid gff-type json structure, or a null value with GetJsonError() set.
json TemplateToJson(string sResRef, int nResType);
// Returns the resource location of sResRef.nResType, as seen by the running module.
// Note for dedicated servers: Checks on the module/server side, not the client.
// Returns "" if the resource does not exist in the search space.
string ResManGetAliasFor(string sResRef, int nResType);
// Finds the nNth available resref starting with sPrefix.
// * Set bSearchBaseData to TRUE to also search base game content stored in your game installation directory.
// WARNING: This can be very slow.
// * Set sOnlyKeyTable to a specific keytable to only search the given named keytable (e.g. "OVERRIDE:").
// Returns "" if no such resref exists.
string ResManFindPrefix(string sPrefix, int nResType, int nNth = 1, int bSearchBaseData = FALSE, string sOnlyKeyTable = "");
// Create a NUI window from the given resref(.jui) for the given player.
// * The resref needs to be available on the client, not the server.
// * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
// * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
// Re-creating a window with the same id of one already open will immediately close the old one.
// * See nw_inc_nui.nss for full documentation.
// Returns the window token on success (>0), or 0 on error.
int NuiCreateFromResRef(object oPlayer, string sResRef, string sWindowId = "");
// Create a NUI window inline for the given player.
// * The token is a integer for ease of handling only. You are not supposed to do anything with it, except store/pass it.
// * The window ID needs to be alphanumeric and short. Only one window (per client) with the same ID can exist at a time.
// Re-creating a window with the same id of one already open will immediately close the old one.
// * See nw_inc_nui.nss for full documentation.
// Returns the window token on success (>0), or 0 on error.
int NuiCreate(object oPlayer, json jNui, string sWindowId = "");
// You can look up windows by ID, if you gave them one.
// * Windows with a ID present are singletons - attempting to open a second one with the same ID
// will fail, even if the json definition is different.
// Returns the token if found, or 0.
int NuiFindWindow(object oPlayer, string sId);
// Destroys the given window, by token, immediately closing it on the client.
// Does nothing if nUiToken does not exist on the client.
// Does not send a close event - this immediately destroys all serverside state.
// The client will close the window asynchronously.
void NuiDestroy(object oPlayer, int nUiToken);
// Returns the originating player of the current event.
object NuiGetEventPlayer();
// Gets the window token of the current event (or 0 if not in a event).
int NuiGetEventWindow();
// Returns the event type of the current event.
// * See nw_inc_nui.nss for full documentation of all events.
string NuiGetEventType();
// Returns the ID of the widget that triggered the event.
string NuiGetEventElement();
// Get the array index of the current event.
// This can be used to get the index into an array, for example when rendering lists of buttons.
// Returns -1 if the event is not originating from within an array.
int NuiGetEventArrayIndex();
// Returns the window ID of the window described by nUiToken.
// Returns "" on error, or if the window has no ID.
string NuiGetWindowId(object oPlayer, int nUiToken);
// Gets the json value for the given player, token and bind.
// * json values can hold all kinds of values; but NUI widgets require specific bind types.
// It is up to you to either handle this in NWScript, or just set compatible bind types.
// No auto-conversion happens.
// Returns a json null value if the bind does not exist.
json NuiGetBind(object oPlayer, int nUiToken, string sBindName);
// Sets a json value for the given player, token and bind.
// The value is synced down to the client and can be used in UI binding.
// When the UI changes the value, it is returned to the server and can be retrieved via NuiGetBind().
// * json values can hold all kinds of values; but NUI widgets require specific bind types.
// It is up to you to either handle this in NWScript, or just set compatible bind types.
// No auto-conversion happens.
// * If the bind is on the watch list, this will immediately invoke the event handler with the "watch"
// even type; even before this function returns. Do not update watched binds from within the watch handler
// unless you enjoy stack overflows.
// Does nothing if the given player+token is invalid.
void NuiSetBind(object oPlayer, int nUiToken, string sBindName, json jValue);
// Swaps out the given element (by id) with the given nui layout (partial).
// * This currently only works with the "group" element type, and the special "_window_" root group.
void NuiSetGroupLayout(object oPlayer, int nUiToken, string sElement, json jNui);
// Mark the given bind name as watched.
// A watched bind will invoke the NUI script event every time it's value changes.
// Be careful with binding nui data inside a watch event handler: It's easy to accidentally recurse yourself into a stack overflow.
int NuiSetBindWatch(object oPlayer, int nUiToken, string sBind, int bWatch);
// Returns the nNth window token of the player, or 0.
// nNth starts at 0.
// Iterator is not write-safe: Calling DestroyWindow() will invalidate move following offsets by one.
int NuiGetNthWindow(object oPlayer, int nNth = 0);
// Return the nNth bind name of the given window, or "".
// If bWatched is TRUE, iterates only watched binds.
// If FALSE, iterates all known binds on the window (either set locally or in UI).
string NuiGetNthBind(object oPlayer, int nToken, int bWatched, int nNth = 0);
// Returns the event payload, specific to the event.
// Returns JsonNull if event has no payload.
json NuiGetEventPayload();
// Get the userdata of the given window token.
// Returns JsonNull if the window does not exist on the given player, or has no userdata set.
json NuiGetUserData(object oPlayer, int nToken);
// Sets an arbitrary json value as userdata on the given window token.
// This userdata is not read or handled by the game engine and not sent to clients.
// This mechanism only exists as a convenience for the programmer to store data bound to a windows' lifecycle.
// Will do nothing if the window does not exist.
void NuiSetUserData(object oPlayer, int nToken, json jUserData);
[ 6078 ]
[ 2063 ]
[ 4243 ]