From fe8755a260834b66c8337a1a4f511f82df1784b2 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Fri, 22 Mar 2024 19:26:23 +0100 Subject: [PATCH] added yl_speak_up.count_dialogs function --- functions.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/functions.lua b/functions.lua index 2ba8a72..1053dfa 100644 --- a/functions.lua +++ b/functions.lua @@ -783,3 +783,20 @@ yl_speak_up.get_sorted_dialog_name_list = function(dialog) end return liste end + + +-- how many own (not special, not generic) dialogs does the NPC have? +yl_speak_up.count_dialogs = function(dialog) + local count = 0 + if(not(dialog) or not(dialog.n_dialogs)) then + return 0 + end + for d_id, v in pairs(dialog.n_dialogs) do + if(d_id + and not(yl_speak_up.is_special_dialog(d_id) + and not(dialog.n_dialogs[d_id].is_generic))) then + count = count + 1 + end + end + return count +end