From 1717ad442b1c222f99e2d3219044139aacc38f89 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Thu, 1 Jul 2021 23:42:43 +0200 Subject: [PATCH] added explanations to the alternate_text edit window --- fs_edit_general.lua | 35 +++++++++++++++++++++++------------ fs_edit_options_dialog.lua | 12 ++++++++++-- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/fs_edit_general.lua b/fs_edit_general.lua index e326d85..52ab2b6 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -887,8 +887,12 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields, yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, formspec = yl_speak_up.get_fs_edit_dialog_modification( - dialog, failure_id, data.alternate_text) - }) + dialog, failure_id, data.alternate_text, + "if the action \""..tostring(x_id).. + "\" of option \""..tostring(o_id).. + "\" of dialog \""..tostring(d_id).. + "\" failed because the player did something wrong") + }) return -- edit alternate text for an on_failure effect elseif(fields.button_edit_effect_on_failure_text_change) then @@ -897,7 +901,11 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields, yl_speak_up.show_fs(player, "msg", { input_to = "yl_speak_up:"..formspec_input_to, formspec = yl_speak_up.get_fs_edit_dialog_modification( - dialog, data.on_failure, data.alternate_text) + dialog, data.on_failure, data.alternate_text, + "if the effect \""..tostring(x_id).. + "\" of option \""..tostring(o_id).. + "\" of dialog \""..tostring(d_id).. + "\" failed to execute correctly") }) return -- save the changes @@ -1796,24 +1804,27 @@ end -- this allows to edit modifications of a dialog that are applied when a given option -- is choosen - i.e. when the NPC wants to answer some questions - but those answers -- do not warrant their own dialog -yl_speak_up.get_fs_edit_dialog_modification = function(dialog, d_id, alternate_dialog_text) +yl_speak_up.get_fs_edit_dialog_modification = function(dialog, d_id, alternate_dialog_text, explanation) return "formspec_version[3]".. - "size[20,13]".. - -- TODO: explain what can be done here - "label[0.2,2.0;This is the normal text of dialog \"".. + "size[20,13.5]".. + "label[6.0,0.5;Edit alternate text]".. + "label[0.2,1.0;The alternate text which you can edit here will be shown instead of ".. + "the normal text of the dialog \""..tostring(d_id).."\" - but *only*\n".. + tostring(explanation or "- missing explanation -")..".]".. + "label[0.2,2.3;This is the normal text of dialog \"".. minetest.formspec_escape(tostring(d_id)).."\", shown for reference:]".. yl_speak_up.show_colored_dialog_text( dialog, {r_id = "", r_type = "dialog"}, d_id, - "1.2,2.3;18.0,4.0;d_text_orig", + "1.2,2.6;18.0,4.0;d_text_orig", "", -- no modifications possible at this step "", "").. -- no edit button here as this text cannot be changed here - "label[0.2,7.0;Enter the alternate text here. $TEXT$ will be replaced with the normal ".. + "label[0.2,7.3;Enter the alternate text here. $TEXT$ will be replaced with the normal ".. "dialog text above:]".. - "textarea[1.2,7.3;18.0,4.5;d_text_new;;".. + "textarea[1.2,7.6;18.0,4.5;d_text_new;;".. minetest.formspec_escape(alternate_dialog_text or "$TEXT$").."]".. - "button[3.0,12.0;1,0.7;back_from_edit_dialog_modification;Abort]".. - "button[6.0,12.0;1,0.7;save_dialog_modification;Save]" + "button[3.0,12.3;1,0.7;back_from_edit_dialog_modification;Abort]".. + "button[6.0,12.3;1,0.7;save_dialog_modification;Save]" end diff --git a/fs_edit_options_dialog.lua b/fs_edit_options_dialog.lua index 8d861eb..b821e37 100644 --- a/fs_edit_options_dialog.lua +++ b/fs_edit_options_dialog.lua @@ -74,7 +74,11 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields) yl_speak_up.show_fs(player, "msg", { input_to = formname, formspec = yl_speak_up.get_fs_edit_dialog_modification( - dialog, target_action.a_on_failure, target_action.alternate_text) + dialog, target_action.a_on_failure, target_action.alternate_text, + "if the action \""..tostring(target_action.a_id).. + "\" of option \""..tostring(o_id).. + "\" of dialog \""..tostring(d_id).. + "\" failed because the player did something wrong") }) return @@ -94,7 +98,11 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields) yl_speak_up.show_fs(player, "msg", { input_to = formname, formspec = yl_speak_up.get_fs_edit_dialog_modification( - dialog, target_effect.r_value, target_effect.alternate_text) + dialog, target_effect.r_value, target_effect.alternate_text, + "if the action ".. + "of option \""..tostring(o_id).. + "\" of dialog \""..tostring(d_id).. + "\" was successful - or if there was no action") }) return