diff --git a/fs_manage_quests.lua b/fs_manage_quests.lua index 44b2aa3..97c4af2 100644 --- a/fs_manage_quests.lua +++ b/fs_manage_quests.lua @@ -32,7 +32,7 @@ yl_speak_up.input_fs_manage_quests_check_fields = function(player, formname, fie quest_name = "" end if(fields and fields.show_variable) then - yl_speak_up.show_fs(player, "manage_variables", quest_name) + yl_speak_up.show_fs(player, "manage_variables", {var_name = quest_name}) return end -- this function didn't have anything to do diff --git a/fs_manage_variables.lua b/fs_manage_variables.lua index 9314924..8f9abb8 100644 --- a/fs_manage_variables.lua +++ b/fs_manage_variables.lua @@ -94,7 +94,8 @@ yl_speak_up.input_fs_manage_variables_check_fields = function(player, formname, -- a player name was given; the value for that player shall be shown elseif(fields and fields.show_stored_value_for_player and var_name and fields.stored_value_for_player and fields.stored_value_for_player ~= "") then - yl_speak_up.show_fs(player, "manage_variables", fields.stored_value_for_player) + yl_speak_up.show_fs(player, "manage_variables", {var_name = var_name, + for_player = fields.stored_value_for_player}) return -- change the value for a player (possibly to nil) elseif(fields and fields.store_new_value_for_player and var_name @@ -295,8 +296,11 @@ yl_speak_up.get_fs_manage_variables = function(player, param) yl_speak_up.strip_pname_from_varlist(var_list, pname) local formspec = {} - if(param and param ~= "") then - local index = table.indexof(var_list, param) + if(not(param) or type(param) ~= "table") then + param = {} + end + if(param and type(param) == "table" and param.var_name and param.var_name ~= "") then + local index = table.indexof(var_list, param.var_name) yl_speak_up.speak_to[pname].tmp_index_general = index + 1 end table.insert(formspec, "size[18,12]".. @@ -304,7 +308,7 @@ yl_speak_up.get_fs_manage_variables = function(player, param) "player who interacts with the NPC.\n".. "You can grant read and write access to other players for your ".. "variables so that they can also use them as well.]") - local selected = yl_speak_up.get_fs_manage_general(player, param, + local selected = yl_speak_up.get_fs_manage_general(player, param.var_name, formspec, var_list, "Create variable", "Create a new varialbe with the name\n".. @@ -378,13 +382,13 @@ yl_speak_up.get_fs_manage_variables = function(player, param) "messages will be sent even after relogin.]") end -- checking/changing debug value for one specific player - if(not(param)) then - param = "" + if(not(param.for_player)) then + param.for_player = "" end table.insert(formspec, "label[0.2,8.05;Show stored value for player:]".. "field[4.9,7.75;4.0,0.6;stored_value_for_player;;") - table.insert(formspec, minetest.formspec_escape(param)) + table.insert(formspec, minetest.formspec_escape(param.for_player)) table.insert(formspec, "]") table.insert(formspec, "button[9.0,7.75;4.5,0.6;show_stored_value_for_player;Show value for this player]".. @@ -392,8 +396,8 @@ yl_speak_up.get_fs_manage_variables = function(player, param) "want to check (or change) the stored value.]".. "tooltip[show_stored_value_for_player;Click here to read and the current value".. "\nstored for this player.]") - if(param and param ~= "") then - local v = yl_speak_up.get_quest_variable_value(param, k_long) or "" + if(param.for_player and param.for_player ~= "") then + local v = yl_speak_up.get_quest_variable_value(param.for_player, k_long) or "" table.insert(formspec, "label[0.2,9.05;Found stored value:]".. "field[4.9,8.75;4.0,0.6;current_value_for_player;;")