From 2d2afdfb26de46c7364e16a41577f21777e2f08c Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sun, 1 Oct 2023 20:18:51 +0200 Subject: [PATCH] added yl_speak_up.check_if_dialog_has_option for easier check if option is available --- functions.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/functions.lua b/functions.lua index e7b2124..1c6d13f 100644 --- a/functions.lua +++ b/functions.lua @@ -715,6 +715,17 @@ yl_speak_up.set_muted = function(p_name, obj, set_muted) end end + +-- checks if dialog contains d_id and o_id +yl_speak_up.check_if_dialog_has_option = function(dialog, d_id, o_id) + return (dialog and d_id and o_id + and dialog.n_dialogs + and dialog.n_dialogs[d_id] + and dialog.n_dialogs[d_id].d_options + and dialog.n_dialogs[d_id].d_options[o_id]) +end + + -- has the player the right privs? -- this is used for the "I am your master" talk based configuration; *NOT* for the staffs! yl_speak_up.may_edit_npc = function(player, n_id)