forked from your-land-mirror/yl_speak_up
corrected obvious errors in a new function
This commit is contained in:
parent
40314125a8
commit
8570fea8ba
@ -131,7 +131,7 @@ yl_speak_up.update_dialog = function(log, dialog, dialog_name, dialog_text)
|
||||
-- name the thing for logging purposes
|
||||
local log_str = "Dialog "..tostring(d_id)
|
||||
if(dialog_name and dialog_name ~= d_id) then
|
||||
log_str = " ["..tostring(dialog_name).."]: "
|
||||
log_str = log_str.." ["..tostring(dialog_name).."]: "
|
||||
end
|
||||
if(not(d_id)) then
|
||||
-- pname is nil - thus no logging and no adding of a back to start option
|
||||
@ -143,6 +143,8 @@ yl_speak_up.update_dialog = function(log, dialog, dialog_name, dialog_text)
|
||||
table.insert(log, log_str.."FAILED to create new dialog.")
|
||||
return nil
|
||||
end
|
||||
-- we got a new name for the log
|
||||
log_str = "New dialog "..tostring(d_id).." ["..tostring(dialog_name).."]: "
|
||||
table.insert(log, log_str.."Successfully created dialog.")
|
||||
|
||||
elseif(dialog.n_dialogs[d_id].d_text ~= dialog_text) then
|
||||
@ -323,7 +325,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
|
||||
-- name the thing for logging purposes
|
||||
local log_str = "Dialog "..tostring(d_id)
|
||||
if(dialog_name and dialog_name ~= d_id) then
|
||||
log_str = " ["..tostring(dialog_name).."], option <"..tostring(option_name)..">: "
|
||||
log_str = log_str.." ["..tostring(dialog_name).."], option <"..tostring(option_name)..">: "
|
||||
end
|
||||
|
||||
-- translate the name of the target_dialog if needed
|
||||
@ -335,7 +337,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
|
||||
local o_id = option_name
|
||||
local mode = 0
|
||||
local text_when_prerequisites_not_met = ""
|
||||
if( o_id and syl_speak_up.string_starts_with(o_id, "new_")) then
|
||||
if( o_id and yl_speak_up.string_starts_with(o_id, "new_")) then
|
||||
-- we are asked to create a *new* option
|
||||
o_id = nil
|
||||
elseif(o_id and yl_speak_up.string_starts_with(o_id, "automaticly_")) then
|
||||
@ -389,7 +391,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
|
||||
and mode ~= 3) then
|
||||
-- else update the text
|
||||
table.insert(log, log_str.."Changed option text from \""..
|
||||
tostring(dialog.n_dialogs[d_id].d_text.d_options[o_id])..
|
||||
tostring(dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met)..
|
||||
"\" to \""..tostring(option_text).."\" for option \""..tostring(o_id).."\".")
|
||||
-- actually update the text
|
||||
dialog.n_dialogs[d_id].d_options[o_id].o_text_when_prerequisites_met = option_text
|
||||
@ -444,7 +446,7 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
|
||||
table.insert(log, log_str.."Changed option \""..tostring(o_id).."\" to RANDOMLY SELECTED.")
|
||||
-- grey out the given text and show that as answer when preconditions not met?
|
||||
elseif(mode == 3) then
|
||||
if((not(o_dat.o_text_when_prerequisites_not_met
|
||||
if((not(o_data.o_text_when_prerequisites_not_met
|
||||
or o_data.o_text_when_prerequisites_not_met ~= text_when_prerequisites_not_met))) then
|
||||
|
||||
table.insert(log, log_str.."Changed option text WHEN PREREQUISITES NOT MET from \""..
|
||||
@ -478,11 +480,12 @@ yl_speak_up.update_dialog_option = function(log, dialog, dialog_name, option_nam
|
||||
-- the visit_only_once option is handled without logging as it might create too many
|
||||
-- entries in the log without adding any helpful information
|
||||
if(visit_only_once
|
||||
and (not(o_data.sb_v.o_visit_only_once) or o_data.o_visit_only_once ~= 1)) then
|
||||
o_data.sb_v.o_visit_only_once = 1
|
||||
and (not(o_data.o_visit_only_once)
|
||||
or o_data.o_visit_only_once ~= 1)) then
|
||||
o_data.o_visit_only_once = 1
|
||||
elseif(not(visit_only_once)
|
||||
and o_data.sb_v.o_visit_only_once and o_data.o_visit_only_once == 1) then
|
||||
o_data.sb_v.o_visit_only_once = nil
|
||||
and o_data.o_visit_only_once and o_data.o_visit_only_once == 1) then
|
||||
o_data.o_visit_only_once = nil
|
||||
end
|
||||
return o_id
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user