diff --git a/fs_edit_general.lua b/fs_edit_general.lua
index f50fba8..01e8116 100644
--- a/fs_edit_general.lua
+++ b/fs_edit_general.lua
@@ -1410,7 +1410,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
data.on_failure,
"1.2,5.8;18.0,2.0;d_text",
", but with the following *modified* text",
- ":]")
+ ":]",
+ "button_effect_on_failure_text_change")
end
formspec = formspec..
"label[0.2,3.3;If the *previous* effect failed,]"..
@@ -1651,15 +1652,17 @@ yl_speak_up.set_on_action_failure_dialog = function(pname, data, instruction)
dialog,
data,
sorted_dialog_list[ nr - 1],
- "1.2,10.2.0;18.0,1.8;d_text",
+ "1.2,10.2;18.0,1.8;d_text",
"label[13.8,9.9;and show the following *modified* text:]",
- "")
+ "",
+ "button_action_on_failure_text_change")
end
return on_failure_dialog
end
-yl_speak_up.show_colored_dialog_text = function(dialog, data, d_id, hypertext_pos, alternate_text, postfix)
+yl_speak_up.show_colored_dialog_text = function(dialog, data, d_id, hypertext_pos,
+ alternate_text, postfix, button_name)
if(not(data)) then
return ""
end
@@ -1697,9 +1700,23 @@ yl_speak_up.show_colored_dialog_text = function(dialog, data, d_id, hypertext_po
-- pname
"")
+ local edit_button = ""
+ -- if there is the possibility that an alternate text may be displayed: allow to edit it
+ -- and calculate the position of the button from the hypertext_pos position and size
+ if(button_name and button_name ~= "") then
+ local parts = string.split(hypertext_pos, ";")
+ local start = string.split(parts[1], ",")
+ local size = string.split(parts[2], ",")
+ edit_button = "button_exit["..
+ tostring(tonumber(start[1]) + tonumber(size[1]) - 3.5)..","..
+ tostring(tonumber(start[2]) + tonumber(size[2]) - 0.9)..";"..
+ "3.0,0.7;"..button_name..";Edit this text]"
+ end
return add_info_alternate_text..
postfix..
"hypertext["..hypertext_pos..";"..
minetest.formspec_escape(text or "?")..
- "\n]"
+ "\n]"..
+ -- display the edit button *inside*/on top of the hypertext field
+ edit_button
end
diff --git a/fs_edit_options_dialog.lua b/fs_edit_options_dialog.lua
index edf0747..206bc3f 100644
--- a/fs_edit_options_dialog.lua
+++ b/fs_edit_options_dialog.lua
@@ -331,7 +331,8 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id, calle
action_data.a_on_failure,
"1.2,0.7;19.6,2.5;d_text_next",
"with the *modified* text",
- ":]")..
+ ":]",
+ "button_edit_action_failed_dialog")..
"container_end[]"
else
action_text = action_text..
@@ -388,7 +389,8 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id, calle
target_dialog,
"1.2,0.7;19.6,2.5;d_text",
"label[13.5,0.4;with the following *modified* text:]",
- "")..
+ "",
+ "button_edit_action_success_dialog")..
"container_end[]"
end
action_text = action_text.."container_end[]"
@@ -416,7 +418,8 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id, calle
d_id,
"1.2,0.3;20.2,2.5;d_text",
"", -- no modifications possible at this step
- "")..
+ "",
+ "").. -- no edit button here as this text cannot be changed here
"tooltip[1.2,0.3;20.2,3.0;This is what the NPC says to the player.]"..
"container_end[]"..