Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Suggestion: SetScriptParam to pass parameters to scripts inside dialogs

prwoprwo Member Posts: 69
edited August 2020 in Builders - Scripting
Since development branch 8193.14 (v80.8193.14 [0caab8c0]) there are two functions, SetScriptParam and GetScriptParam, that allow to pass string parameters (key value pairs) from an outside script (calling SetScriptParam before Execute) to an inside script called by ExecuteScript (then using GetScriptParam inside to retrieve the values).

There is even a way in the toolset's conversation editor to statically set these key value pairs as script parameters for conditional and action scrips inside dialogs.

However, these parameters are only available in the context of the script that is currently executed and not in the context of the whole dialog.

I would require a similar way to set parameters before ActionStartConversation that can be read out by all scripts used inside that dialog.

For example:
SetDialogParam("DialogParam", "SomeValue");
ActionStartConversation(oPC, "mydlg");

// inside mydlg e.g. in a conditional script controlling the very first line of the dialog
string sParam = GetDialogParam("DialogParam");
if (sParam == "...") ...

There is a workaround to achieve this by setting the dialog parameter as local variable on the (first) PC or the module. However, while this works most of the times, it is still error prone especially when the player cancels the ActionStartConversation and hence parameters set for one dialog bleed over to other dialogs, for which they were not intendet.

Sign In or Register to comment.