diff --git a/README.md b/README.md index 878c22f..4365531 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,11 @@ NPC, inventory movements and purchases are logged. The log shows the date but not the time of the action. Players can view the logs of their own NPC. +If you want to keep an NPC from logging, set the property + server_nolog_effects to i.e "true" +That way, the NPC will no longer log or send debug messages when executing +effects. + ### 13. Quest items diff --git a/exec_apply_effects.lua b/exec_apply_effects.lua index a4e9fdc..bdbd421 100644 --- a/exec_apply_effects.lua +++ b/exec_apply_effects.lua @@ -70,16 +70,24 @@ yl_speak_up.execute_all_relevant_effects = function(player, effects, o_id, actio local last_result = action_was_successful local res = true local refuse_items = true + local properties = yl_speak_up.get_npc_properties(pname) + local no_log = properties["server_nolog_effects"] for i, k in ipairs(sorted_key_list) do local r = effects[ k ] yl_speak_up.debug_msg(player, n_id, o_id, "..executing ".. tostring(r.r_id)..": "..yl_speak_up.show_effect(r, pname)) -- do not execute effects in edit mode if(not(edit_mode)) then - yl_speak_up.debug_msg(player, n_id, o_id, - "Executing effect "..tostring(r.r_id)..".") + if(not(no_log)) then + yl_speak_up.debug_msg(player, n_id, o_id, + "Executing effect "..tostring(r.r_id)..".") + end res = yl_speak_up.execute_effect(player, n_id, o_id, r) - if(not(res)) then + if(no_log) then + if(not(res)) then + alternate_text = r.alternate_text + end + elseif(not(res)) then yl_speak_up.debug_msg(player, n_id, o_id, tostring(r.r_id).. " -> Effect failed to execute.") if(r.r_type ~= "dialog") then