better loggin for update_dialog_option

This commit is contained in:
Sokomine 2025-01-04 19:21:10 +01:00
parent d2fdb6da61
commit 0cd28dcb54

View File

@ -525,6 +525,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
for r_id, r in pairs(o_data.o_results or {}) do for r_id, r in pairs(o_data.o_results or {}) do
-- we found the right result/effect that holds the (current) target_dialog -- we found the right result/effect that holds the (current) target_dialog
if(r and r.r_type and r.r_type == "dialog") then if(r and r.r_type and r.r_type == "dialog") then
r_found = true
if(not(r.r_value) or r.r_value ~= target_dialog) then if(not(r.r_value) or r.r_value ~= target_dialog) then
if(is_new) then if(is_new) then
table.insert(log, log_str.."Successfully created new option \"".. table.insert(log, log_str.."Successfully created new option \""..
@ -536,7 +537,6 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
"\" for option \""..tostring(o_id).."\".") "\" for option \""..tostring(o_id).."\".")
end end
-- actually change the target dialog -- actually change the target dialog
r_found = true
r.r_value = target_dialog r.r_value = target_dialog
end end
-- the alternate_text may have been changed -- the alternate_text may have been changed
@ -549,6 +549,10 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
end end
end end
-- for some reason the effect pointing to the target dialog got lost! -- for some reason the effect pointing to the target dialog got lost!
if(r_found and is_new) then
table.insert(log, log_str.."Set target dialog to "..tostring(target_dialog)..
" for new option \""..tostring(o_id).."\".")
end
if(not(r_found)) then if(not(r_found)) then
-- create the result/effect that points to the target_dialog -- create the result/effect that points to the target_dialog
local r_id = yl_speak_up.add_new_result(dialog, d_id, o_id) local r_id = yl_speak_up.add_new_result(dialog, d_id, o_id)