diff --git a/exec_eval_preconditions.lua b/exec_eval_preconditions.lua index f6cf487..a1a8468 100644 --- a/exec_eval_preconditions.lua +++ b/exec_eval_preconditions.lua @@ -86,6 +86,12 @@ yl_speak_up.eval_precondition = function(player, n_id, p, other_options_true_or_ elseif(p.p_type == "auto") then -- a precondition set by using the staff; kept for compatibility return true + elseif(p.p_type == "true") then + -- mostly useful for generic dialogs + return true + elseif(p.p_type == "false") then + -- mostly useful for temporally disabling options + return false elseif(p.p_type == "function") then if(not(yl_speak_up.npc_has_priv(n_id, "precon_exec_lua", p.p_is_generic))) then return false diff --git a/fs_edit_general.lua b/fs_edit_general.lua index 52f317e..e064939 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -755,6 +755,11 @@ yl_speak_up.save_element_p_or_a_or_e = function( if(data.fulfilled and data.fulfilled ~= "-select-") then v[ "p_fulfilled" ] = data.fulfilled end + + elseif(what_type == "true") then + v[ "p_value" ] = true -- doesn't matter here - just *some* value + elseif(what_type == "false") then + v[ "p_value" ] = true -- doesn't matter here - just *some* value end v[ "alternate_text" ] = data.alternate_text diff --git a/fs_edit_preconditions.lua b/fs_edit_preconditions.lua index bb207c8..ab5bf95 100644 --- a/fs_edit_preconditions.lua +++ b/fs_edit_preconditions.lua @@ -71,6 +71,8 @@ local check_what = { "execute Lua code (requires npc_master priv)", -- 7 -> 9 "Call custom functions that are supposed to be overridden by the server.", -- 8 -> 10 "The preconditions of another dialog option are fulfilled/not fulfilled.", -- 9 -> 11 + "nothing - always true (useful for generic dialogs)", + "nothing - always false (useful for temporally deactivating an option)", } -- how to store these as p_type in the precondition: @@ -82,7 +84,8 @@ local values_what = {"", "state", "block", "trade", -- custom function (does not require npc_master priv) "custom", -- depends on the preconditions of another option - "other"} + "other", + "true", "false"} -- options for "a trade" local check_trade = { @@ -177,6 +180,10 @@ yl_speak_up.show_precondition = function(p, pname) return "quest: Always false." elseif(p.p_type == "auto") then return "auto: Always true." + elseif(p.p_type == "true") then + return "true: Always true." + elseif(p.p_type == "false") then + return "false: Always false." elseif(p.p_type == "function") then return "function: evaluate "..tostring(p.p_value) elseif(p.p_type == "state") then