fixed bug in update_dialog_option regarding automaticly selected and random options

This commit is contained in:
Sokomine 2025-01-07 20:02:23 +01:00
parent 7c801291f9
commit d5b5832b02

View File

@ -215,8 +215,8 @@ yl_speak_up.update_dialog = function(log, dialog, dialog_name, dialog_text)
-- the random option is set for the dialog entire; we will have to process the individual
-- options in order to find out if this dialog is o_random; the first option that is sets
-- it for the dialog
d_data.o_random = nil
-- it for the dialog -> keep the old value
--d_data.o_random = nil
-- there may be existing options that won't get updated; deal with them:
-- remember which options the dialog has and which sort order they had
@ -603,11 +603,8 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
local d_data = dialog.n_dialogs[d_id]
-- is this option selected randomly?
if( mode == 2 and not(d_data.o_random)) then
table.insert(log, log_str.."Changed DIALOG \""..tostring(d_id).."\" to RANDOMLY SELECTED.")
d_data.o_random = 1
table.insert(log, log_str.."Changed DIALOG \""..tostring(d_id).."\" to RANDOMLY SELECTED.")
elseif(mode ~= 2 and d_data.o_random) then
d_data.o_random = nil
table.insert(log, log_str.."Changed DIALOG \""..tostring(d_id).."\" to RANDOMLY SELECTED.")
end
-- is this option selected automaticly if all preconditions are met?
@ -615,7 +612,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
o_data.o_autoanswer = 1
table.insert(log, log_str.."Changed option \""..tostring(o_id).."\" to AUTOMATICLY SELECTED.")
-- mode is 0 - that means everything is normal for this option
elseif(o_data.o_autoanswer) then
elseif(mode ~= 1 and o_data.o_autoanswer) then
o_data.o_autoanswer = nil
table.insert(log, log_str.."Removed AUTOMATICLY SELECTED from option \""..tostring(o_id).."\".")
end