Project Zomboid

Project Zomboid

Recraft Your Tools
Azazellz  [developer] 20 Sep, 2021 @ 2:41pm
Found a bug? Post it here!
Recraft Your Tools: thread for bug hunting.
< >
Showing 1-8 of 8 comments
Oxicore 1 Oct, 2021 @ 2:25am 
While trying to sharpen an axe, the crafting menu does not seem to detect the belt I have in my inventory (belt is greyed out), tried both with unequipped starter belt and craftable ones. Am I missing something?
Azazellz  [developer] 1 Oct, 2021 @ 4:31am 
Wait, what? Sharpen?
This feature is not in my mod. And no belts were used anywhere.

The only possible bug I know right now is related with the welding mask.
If it is added to favorites, recipes with metal tools and handles will be inactive.
Oxicore 1 Oct, 2021 @ 4:42am 
My bad, I was sure it was this mod. My apologies.
Muffinman 14 Jan, 2022 @ 4:16am 
The ModOption array is missing declaration for the server
LOG : Lua , 1642162339981> 563,158,010> Loading: steamapps/workshop/content/108600/2607414076/mods/RecraftYourTools/media/lua/server/RYT_recipecode.lua LOG : General , 1642162339982> 563,158,011> ------------------------------------------------------------- attempted index: OPTIONS of non-table: null LOG : General , 1642162339985> 563,158,014> ----------------------------------------- STACK TRACE ----------------------------------------- function: RYT_recipecode.lua -- file: RYT_recipecode.lua line # 3 ERROR: General , 1642162339987> 563,158,016> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: OPTIONS of non-table: null at KahluaThread.tableget line:1689. ERROR: General , 1642162339987> 563,158,016> DebugLogStream.printException> Stack trace: java.lang.RuntimeException: attempted index: OPTIONS of non-table: null at se.krka.kahlua.vm.KahluaThread.tableget(KahluaThread.java:1689) at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:492) at se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:163) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1980) at se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1782) at se.krka.kahlua.integration.LuaCaller.pcall(LuaCaller.java:76) at se.krka.kahlua.integration.LuaCaller.protectedCall(LuaCaller.java:117) at zombie.Lua.LuaManager.RunLuaInternal(LuaManager.java:550) at zombie.Lua.LuaManager.RunLua(LuaManager.java:496) at zombie.Lua.LuaManager.RunLua(LuaManager.java:482) at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:329) at zombie.Lua.LuaManager.LoadDirBase(LuaManager.java:256) at zombie.network.GameServer.doMinimumInit(GameServer.java:1364) at zombie.network.GameServer.main(GameServer.java:668) LOG : General , 1642162339988> 563,158,017> ----------------------------------------- STACK TRACE ----------------------------------------- function: RYT_recipecode.lua -- file: RYT_recipecode.lua line # 3

Line #3 is
local OPT1 = RYT.OPTIONS
but nothing preceeds it to declare RYT.OPTIONS. Copying the definition from client\RYT.OPTIONS.lua and adding that above line #3 fixes the problem.
Azazellz  [developer] 14 Jan, 2022 @ 8:57am 
Originally posted by Muffinman:
Copying the definition from client\RYT.OPTIONS.lua and adding that above line #3 fixes the problem.

I have zero knowledge in lua, and most of my code was written just by mashing buttons and seeing if it worked.

So it should work if i add this
RYT = {} RYT.OPTIONS = OPTIONS
before line 3, right?

Or just
RYT.OPTIONS = OPTIONS
is enough?
Muffinman 14 Jan, 2022 @ 10:39pm 
Originally posted by Azazellz:
Originally posted by Muffinman:
Copying the definition from client\RYT.OPTIONS.lua and adding that above line #3 fixes the problem.

I have zero knowledge in lua, and most of my code was written just by mashing buttons and seeing if it worked.

So it should work if i add this
RYT = {} RYT.OPTIONS = OPTIONS

You need both and you also need to define `OPTIONS` before you can assign it to RYT.OPTIONS

RYT = {} means it's an empty table
RYT.OPTIONS = <something> is the same thing as
RYT = {
OPTIONS = <something> ; here <something> can either be a value or reference to another table
}

In \client\RYT.OPTIONS.lua, you defined OPTIONS to be a table with one key/value pair, namely "Difficulty" = 1. If you are able to some how "require" the client file, then you don't need to declare again
Azazellz  [developer] 15 Jan, 2022 @ 5:18am 
Originally posted by Muffinman:
In \client\RYT.OPTIONS.lua, you defined OPTIONS to be a table with one key/value pair, namely "Difficulty" = 1. If you are able to some how "require" the client file, then you don't need to declare again

But if I declare it again in RYT_Recipecode, then how it will receive data from RYT_Options then?.. I thought that the way I declared it is global, and can be read from anywhere. And it worked in single mode.

Does
require("RYT_Options");
will even work here?..
Or can I try to move all the files to the "server" folder?

MP coding is so confusing...
Last edited by Azazellz; 15 Jan, 2022 @ 5:25am
Muffinman 17 Jan, 2022 @ 8:33am 
Originally posted by Azazellz:
Originally posted by Muffinman:
In \client\RYT.OPTIONS.lua, you defined OPTIONS to be a table with one key/value pair, namely "Difficulty" = 1. If you are able to some how "require" the client file, then you don't need to declare again

But if I declare it again in RYT_Recipecode, then how it will receive data from RYT_Options then?.. I thought that the way I declared it is global, and can be read from anywhere. And it worked in single mode.

Does
require("RYT_Options");
will even work here?..
Or can I try to move all the files to the "server" folder?

MP coding is so confusing...

I don't write PZ mod so I can not tell you for sure how the lookup dependencies for the "require" statements work.

However, there is a "shared" folder and it seems you can simply put files in there with the the name you want, let say Options.lua. Then you can require them for things in the server and client folder by name.

You should consult IsTimer.lua in \media\luaexamples\IsTimer.lua. Now at the very top of the file is the line
require "IsBaseObject"
. IsBaseObject is a lua file in \media\lua\shared. This folder is totally in a different path than IsTimer.lua and yet the required statement did not have a path, just a filename.

Indeed, the paths are
\media\luaexamples\IsTimer.lua <- path of file requiring "IsBaseObject"
\media\lua\shared\IsBaseObject.lua <- path of the required file, totally in a different folder

So, here you can have

\media\lua\client\RYT_Options.lua
\media\lua\server\RYT_Options.lua
\media\lua\shared\Options.lua

In each RYT_Options.lua, at the top, write
require "Options"
. So for the one in client\RYT_Options.lua,

require "Options" if ModOptions and ModOptions.getInstance then local settings = ModOptions:getInstance(OPTIONS, "RYT", "Recraft your tools") local drop1 = settings:getData("Difficulty") drop1[1] = getText("IGUI_RYT_Easy") --"Easy" drop1[2] = getText("IGUI_RYT_Normal") --"Normal" drop1[3] = getText("IGUI_RYT_Hard") --"Hard" drop1[4] = getText("IGUI_RYT_VeryHard") --"VeryHard" drop1.tooltip = "IGUI_RYT_DropdownList_Tooltip" settings.names = { Difficulty = "IGUI_RYT_Difficulty", } end

For the one in server\RYT_Options.lua,

require "recipecode" require "Options" RYT = {} RYT.OPTIONS = "OPTIONS" local OPT1 = RYT.OPTIONS <the rest of the code currently in file>


In \media\lua\shared\Options.lua, then write the code you want for the tables that will be shared across the client and server. In this case,

local OPTIONS = { Difficulty = 1, -- default index of choice }

I hope that makes sense.
Last edited by Muffinman; 17 Jan, 2022 @ 8:34am
< >
Showing 1-8 of 8 comments
Per page: 1530 50