improved logging of actions

This commit is contained in:
Sokomine 2022-10-08 23:48:20 +02:00
parent 6befa8f10a
commit dbc7f4a12c

View File

@ -212,8 +212,8 @@ yl_speak_up.execute_next_action = function(player, a_id, result_of_a_id)
tostring(this_action.a_on_failure)..".")
yl_speak_up.log_change(pname, n_id,
"Player failed to complete action "..tostring(a_id)..
" of "..tostring(o_id).." of "..tostring(d_id)..": "..
tostring(this_action.a_value)..".")
" "..tostring(o_id).." "..tostring(d_id)..": "..
yl_speak_up.show_action(this_action))
yl_speak_up.speak_to[pname].d_id = this_action.a_on_failure
yl_speak_up.speak_to[pname].o_id = nil
yl_speak_up.speak_to[pname].a_id = nil
@ -222,9 +222,11 @@ yl_speak_up.execute_next_action = function(player, a_id, result_of_a_id)
alternate_text = this_action.alternate_text})
return
else
local this_action = actions[ sorted_key_list[ nr ]]
yl_speak_up.log_change(pname, n_id,
"Player completed action "..tostring(a_id)..
" of "..tostring(o_id).." of "..tostring(d_id)..".")
" "..tostring(o_id).." "..tostring(d_id)..": "..
yl_speak_up.show_action(this_action))
end
end
-- get the next entry
@ -404,9 +406,9 @@ yl_speak_up.action_quest_item_check = function(player)
" Expected: "..tostring(a.a_value)..".")
yl_speak_up.log_change(pname, n_id,
"Action "..tostring(a_id)..
" of "..tostring(yl_speak_up.speak_to[pname].o_id)..
" of "..tostring(yl_speak_up.speak_to[pname].d_id)..
"failed: Player gave item \""..tostring(cmp).."\", but we wanted: \""..
" "..tostring(yl_speak_up.speak_to[pname].o_id)..
" "..tostring(yl_speak_up.speak_to[pname].d_id)..
" failed: Player gave item \""..tostring(cmp).."\", but we wanted: \""..
tostring(a.a_value).."\".")
return false
end
@ -420,9 +422,9 @@ yl_speak_up.action_quest_item_check = function(player)
": Wrong quest item (wrong ID).")
yl_speak_up.log_change(pname, n_id,
"Action "..tostring(a_id)..
" of "..tostring(yl_speak_up.speak_to[pname].o_id)..
" of "..tostring(yl_speak_up.speak_to[pname].d_id)..
"failed: Player gave wrong quest item (wrong ID).")
" "..tostring(yl_speak_up.speak_to[pname].o_id)..
" "..tostring(yl_speak_up.speak_to[pname].d_id)..
" failed: Player gave item with wrong quest ID.")
return false
end
-- was this quest item given to another player?
@ -433,9 +435,9 @@ yl_speak_up.action_quest_item_check = function(player)
", but "..tostring(pname).." gave it.")
yl_speak_up.log_change(pname, n_id,
"Action "..tostring(a_id)..
" of "..tostring(yl_speak_up.speak_to[pname].o_id)..
" of "..tostring(yl_speak_up.speak_to[pname].d_id)..
"failed: Player gave quest item that belonged to player "..
" "..tostring(yl_speak_up.speak_to[pname].o_id)..
" "..tostring(yl_speak_up.speak_to[pname].d_id)..
" failed: Player gave quest item that belonged to player "..
tostring(meta:get_string("yl_speak_up:quest_item_for"))..".")
return false
end
@ -672,15 +674,15 @@ yl_speak_up.input_fs_action_text_input = function(player, formname, fields)
if(not(success)) then
yl_speak_up.log_change(pname, n_id,
"Action "..tostring(a_id)..
" of "..tostring(yl_speak_up.speak_to[pname].o_id)..
" of "..tostring(yl_speak_up.speak_to[pname].d_id)..
" "..tostring(yl_speak_up.speak_to[pname].o_id)..
" "..tostring(yl_speak_up.speak_to[pname].d_id)..
": Player answered with \""..tostring(fields.quest_answer:trim())..
"\", but we expected: \""..tostring(a.a_value:trim()).."\".")
else
yl_speak_up.log_change(pname, n_id,
"Action "..tostring(a_id)..
" of "..tostring(yl_speak_up.speak_to[pname].o_id)..
" of "..tostring(yl_speak_up.speak_to[pname].d_id)..
" "..tostring(yl_speak_up.speak_to[pname].o_id)..
" "..tostring(yl_speak_up.speak_to[pname].d_id)..
": Answer is correct.")
end
-- the action was a either a success or failure