export to ink: support autoanswer, random and grey out answer

This commit is contained in:
Sokomine 2024-12-27 17:40:51 +01:00
parent e1f13f7bff
commit 7e3ea18653

View File

@ -508,12 +508,34 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
vars_used)
-- what remains is to print the option/choice itself
local o_text = o_data.o_text_when_prerequisites_met
if( o_data.o_autoanswer) then
o_text = "[Automaticly selected if preconditions are met]"
elseif(o_data.o_random) then
o_text = "[One of these options is randomly selected]"
end
ink_export.print_choice(tmp,
-- TODO: deal with when_prerequisites_not_met
o_data.o_text_when_prerequisites_met, use_prefix, start_dialog,
o_text, use_prefix, start_dialog,
alternate_text_on_success, target_dialog,
o_data.o_visit_only_once,
o_data.o_visit_only_once, -- print + (often) or * (only once)
o_id, p_list, e_list, dialog_names)
-- deal with o_grey_when_prerequisites_not_met (grey out this answer)
if( o_data.o_text_when_prerequisites_not_met
and o_data.o_text_when_prerequisites_not_met ~= ""
and o_data.o_grey_when_prerequisites_not_met
and o_data.o_grey_when_prerequisites_not_met == "true") then
o_text = o_data.o_text_when_prerequisites_not_met
-- this option cannot be selected - so choose d_end as target dialog
ink_export.print_choice(tmp,
o_text, use_prefix, start_dialog,
alternate_text_on_success, "d_end",
o_data.o_visit_only_once, -- print + (often) or * (only once)
"grey_out_"..o_id, p_list, e_list, dialog_names)
end
-- Note: Showing an alternate text if the preconditions are not met is not
-- covered here. It makes little sense for the NPC as the option appears
-- but cannot be clicked. It exists for backward compatibility of old NPC
-- on the Your Land server.
end -- dealt with the option
-- add way to end talking to the NPC
ink_export.print_choice(tmp, "Farewell!", use_prefix, start_dialog,