d_name supported for on_failure effects

This commit is contained in:
Sokomine 2024-03-10 18:34:28 +01:00
parent 7471691d55
commit 86e4d9a3fa

View File

@ -1015,7 +1015,9 @@ yl_speak_up.handle_input_fs_edit_option_related = function(player, formname, fie
end
if(fields.select_on_failure) then
-- in this case we really want the name of the target dialog
yl_speak_up.speak_to[pname][ tmp_data_cache ].on_failure = fields.select_on_failure
local dialog = yl_speak_up.speak_to[pname].dialog
yl_speak_up.speak_to[pname][ tmp_data_cache ].on_failure =
yl_speak_up.d_name_to_d_id(dialog, fields.select_on_failure)
end
if(fields.select_on_action_failure
and data and data.what and id_prefix == "a_") then
@ -2112,12 +2114,15 @@ yl_speak_up.get_sub_fs_edit_option_effect_on_failure = function(
data.alternate_text = e[ "alternate_text" ]
end
local dialog = yl_speak_up.speak_to[pname].dialog
local sorted_dialog_list = yl_speak_up.sort_keys(dialog.n_dialogs)
local sorted_dialog_list = yl_speak_up.get_sorted_dialog_name_list(dialog)
local nr = 1
if(not(data) or not(data.on_failure)) then
if(not(data) or not(data.on_failure)
or not(dialog.n_dialogs)
or not(dialog.n_dialogs[data.on_failure])) then
save_button = ""
else
nr = table.indexof(sorted_dialog_list, data.on_failure)
local t = dialog.n_dialogs[data.on_failure].d_name or data.on_failure
nr = math.max(0, table.indexof(sorted_dialog_list, t))
end
local on_failure_dialog = ""
if(dialog and dialog.n_dialogs and dialog.n_dialogs[ data.on_failure ]) then
@ -2511,7 +2516,7 @@ yl_speak_up.set_on_action_failure_dialog = function(pname, data, instruction)
if(data and data.action_failure_dialog
and dialog.n_dialogs
and dialog.n_dialogs[data.action_failure_dialog]) then
local t = dialog.n_dialogs[data.action_failure_dialog].d_name or data.action_failure_dialog
local t = dialog.n_dialogs[data.action_failure_dialog].d_name or data.action_failure_dialog
nr = math.max(0, table.indexof(sorted_dialog_list, t)) + 1
end
local start_at = "9.9;"