mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-06-21 06:38:02 +02:00
added show var usage (partially)
This commit is contained in:
parent
14e0902cf1
commit
bea29aed26
@ -702,7 +702,8 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
|
||||
return
|
||||
end
|
||||
|
||||
if(fields.back_from_cannot_be_edited) then
|
||||
if(fields.back_from_cannot_be_edited
|
||||
or fields.back_from_show_var_usage) then
|
||||
yl_speak_up.show_fs(player, formspec_input_to, x_id)
|
||||
return
|
||||
end
|
||||
@ -946,6 +947,37 @@ yl_speak_up.input_fs_edit_option_related = function(player, formname, fields,
|
||||
was_changed = true
|
||||
end
|
||||
|
||||
-- show var usage - starting from clicking on a precondition or effect in the
|
||||
-- edit options menu and viewing the list containing that selected element
|
||||
if( fields.show_var_usage and x_id) then
|
||||
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||
local element = dialog.n_dialogs[d_id].d_options[o_id][ element_list_name ][ x_id ]
|
||||
if(element and element[ id_prefix.."variable"]) then
|
||||
-- TODO: actually implement/show usage of the variable as formspec
|
||||
yl_speak_up.show_fs(player, "msg", {
|
||||
input_to = "yl_speak_up:"..formspec_input_to,
|
||||
formspec = "size[9,2]"..
|
||||
"label[0.2,0.5;This ought to show usage of a variable.]"..
|
||||
-- back to the list with that one precondition or effect
|
||||
"button[1.5,1.5;2,0.9;back_from_show_var_usage;Back]"})
|
||||
return
|
||||
end
|
||||
-- show var usuage - but this time from the edit dialog for that precondition or effect
|
||||
elseif(fields.show_var_usage_edit_element and x_id) then
|
||||
local dialog = yl_speak_up.speak_to[pname].dialog
|
||||
local element = dialog.n_dialogs[d_id].d_options[o_id][ element_list_name ][ x_id ]
|
||||
if(element and element[ id_prefix.."variable"]) then
|
||||
-- TODO: actually implement/show usage of the variable as formspec
|
||||
yl_speak_up.show_fs(player, "msg", {
|
||||
input_to = "yl_speak_up:"..formspec_input_to,
|
||||
formspec = "size[9,2]"..
|
||||
"label[0.2,0.5;This ought to show usage of a variable.]"..
|
||||
-- back to editing that particular precondition or effect
|
||||
"button[1.5,1.5;2,0.9;back_from_error_msg;Back]"})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- the player wants to change/edit a precondition or effect
|
||||
if(not(fields.back)
|
||||
and (fields.change_element or fields.select_what or fields.select_trade
|
||||
@ -1108,6 +1140,16 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
|
||||
x_id = table_click_result
|
||||
end
|
||||
|
||||
local show_var_usage = ""
|
||||
if(x_id
|
||||
and elements
|
||||
and elements[ x_id ]
|
||||
and elements[ x_id ][ id_prefix.."type"]
|
||||
and elements[ x_id ][ id_prefix.."type"] == "state"
|
||||
and elements[ x_id ][ id_prefix.."variable"]) then
|
||||
show_var_usage = "button[12.0,1.8;6.5,0.9;show_var_usage;"..
|
||||
"Show where this variable is used]"
|
||||
end
|
||||
-- store which element we are talking about
|
||||
yl_speak_up.speak_to[pname][ id_prefix.."id" ] = x_id
|
||||
-- nothing selected yet
|
||||
@ -1129,7 +1171,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result,
|
||||
"button[2.0,1.8;1.5,0.9;delete_element;Delete]"..
|
||||
"button[4.0,1.8;1.5,0.9;change_element;Change]"..
|
||||
"button[6.0,1.8;5.5,0.9;back;Back to edit dialog option \""..
|
||||
tostring(o_id).."\"]"
|
||||
tostring(o_id).."\"]"..
|
||||
show_var_usage
|
||||
end
|
||||
end
|
||||
|
||||
@ -1365,6 +1408,7 @@ yl_speak_up.get_fs_edit_option_p_and_e_state = function(
|
||||
"label[11.2,4.3;"..text_select_value.."]"..
|
||||
field_for_value..
|
||||
"button[0.2,6.0;4.0,0.6;manage_variables;Manage variables]"..
|
||||
"button[4.7,6.0;6.5,0.6;show_var_usage_edit_element;Show where this variable is used]"..
|
||||
"hypertext[1.2,7.0;16.0,2.5;some_text;<normal>"..
|
||||
"<b>Note:</b> Each variable is player-specific and will be set and "..
|
||||
"checked for the player that currently talks to your NPC.\n"..
|
||||
|
Loading…
Reference in New Issue
Block a user