export_to_ink: added labels for options

This commit is contained in:
Sokomine 2024-03-02 15:48:13 +01:00
parent 9781ea9b43
commit 1c89bd7dcf

View File

@ -58,13 +58,19 @@ end
-- displayed instead (in yl_speak_up) and before (in ink) shwoing the target dialog text;
-- also, the divert_to target dialog may need to be rewritten
yl_speak_up.export_to_ink.print_choice = function(lines, choice_text, n_id, start_dialog,
alternate_text, divert_to, only_once)
alternate_text, divert_to, only_once, label)
-- don't repeat the text of the choice in the output when running ink
if(not(only_once)) then
table.insert(lines, "\n+ [")
table.insert(lines, "\n+ ")
else
table.insert(lines, "\n* [")
table.insert(lines, "\n* ")
end
if(label and label ~= "") then
table.insert(lines, "(")
table.insert(lines, tostring(label))
table.insert(lines, ") ")
end
table.insert(lines, "[")
table.insert(lines, choice_text)
table.insert(lines, "]")
-- dialogs, actions and effects can have an alternate_text with which they override the
@ -132,13 +138,13 @@ yl_speak_up.export_to_ink.print_action_knot = function(lines, n_id, d_id, o_id,
table.insert(lines, yl_speak_up.show_action(a))
ink_export.print_choice(lines, "Action was successful", n_id, start_dialog,
alternate_text_on_success, next_target, false)
alternate_text_on_success, next_target, false, nil)
ink_export.print_choice(lines, "Action failed", n_id, start_dialog,
a.alternate_text, a.a_on_failure, false)
a.alternate_text, a.a_on_failure, false, nil)
ink_export.print_choice(lines, "Back", n_id, start_dialog,
nil, tostring(n_id).."_"..tostring(d_id), false)
nil, tostring(n_id).."_"..tostring(d_id), false, nil)
return knot_name
end
@ -167,10 +173,10 @@ yl_speak_up.export_to_ink.print_effect_knot = function(lines, n_id, d_id, o_id,
table.insert(lines, yl_speak_up.show_effect(r_prev))
ink_export.print_choice(lines, "Effect was successful", n_id, start_dialog,
alternate_text_on_success, next_target, false)
alternate_text_on_success, next_target, false, nil)
ink_export.print_choice(lines, "Effect failed", n_id, start_dialog,
r.alternate_text, r.r_value, false)
r.alternate_text, r.r_value, false, nil)
return knot_name
end
@ -263,12 +269,14 @@ yl_speak_up.export_to_ink_language = function(dialog, n_id)
ink_export.print_choice(tmp,
-- TODO: deal with when_prerequisites_not_met
o_data.o_text_when_prerequisites_met, n_id, start_dialog,
alternate_text_on_success, target_dialog, o_data.o_visit_only_once)
alternate_text_on_success, target_dialog,
o_data.o_visit_only_once,
o_id)
end -- dealt with the option
table.insert(tmp, "\n")
-- add way to end talking to the NPC
ink_export.print_choice(tmp, "Farewell!", n_id, start_dialog,
nil, tostring(n_id).."_main", false)
nil, tostring(n_id).."_main", false, nil)
-- add the knots for actions and effects for this dialog and all its options:
for _, line in ipairs(tmp2) do