diff --git a/fs_edit_general.lua b/fs_edit_general.lua index 6fc8f1a..ca7c206 100644 --- a/fs_edit_general.lua +++ b/fs_edit_general.lua @@ -844,7 +844,7 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, data.var_cmp_value = e[ id_prefix.."var_cmp_value" ] data.variable_name = e[ id_prefix.."variable" ] local var_list = get_sorted_player_var_list_function(pname) - data.variable = math.max(1, table.indexof(var_list, e[ id_prefix.."variable"])) + data.variable = math.max(1, table.indexof(var_list, e[ id_prefix.."variable"])+1) -- a block (precondition + effect) elseif(data.what == 3 and id_prefix ~= "a_") then data.block = math.max(1,table.indexof(values_block, e[ id_prefix.."value" ])) @@ -940,8 +940,8 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, -- "an internal state (i.e. of a quest)", -- 2 -- (state is the second offered option in both preconditions and effects list) if(data.what and data.what == 2 and id_prefix ~= "a_") then - if(not(data.variable) or data.variable == 1) then - data.variable = 1 + if(not(data.variable) or data.variable < 1) then + data.variable = 0 -- not enough selected yet for saving save_button = "" elseif(not(data.operator) or data.operator == 1) then @@ -962,12 +962,16 @@ yl_speak_up.get_fs_edit_option_related = function(player, table_click_result, -- the player has read access to, and the order has to be constant -- (because dropdown just returns an index) local var_list = get_sorted_player_var_list_function(pname) + local var_list_text = "- please select -" + for i, v in ipairs(var_list) do + var_list_text = var_list_text..","..minetest.formspec_escape(tostring(v)) + end formspec = formspec.. "label[0.2,3.3;"..text_variable.."]".. "label[0.2,4.3;Name of variable:]".. "dropdown[0.2,4.8;6.5,0.6;select_variable;".. - table.concat(var_list, ",")..";".. - tostring(data.variable)..";]".. + var_list_text..";".. + tostring(data.variable + 1)..";]".. "label[7.0,4.3;"..text_select_operator.."]".. "dropdown[7.0,4.8;4.0,0.6;select_operator;".. table.concat(check_operator, ",")..";".. diff --git a/fs_edit_preconditions.lua b/fs_edit_preconditions.lua index d5a145e..66f53d0 100644 --- a/fs_edit_preconditions.lua +++ b/fs_edit_preconditions.lua @@ -103,7 +103,7 @@ local values_operator = {"", "==", "~=", ">=", ">", "<=", "<", "not", "is_set", -- some internal ones... local check_variable = { - "- please select -", +-- "- please select -", -- this is automaticly added to the var list "(internal) hour of ingame day", -- 2 "(internal) player's health points", -- 3 }