Skip to content

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.

https://steamcommunity.com/games/704450/announcements/detail/2724067792533337541

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.