Project Zomboid

Project Zomboid

Item Tweaker API (obsolete)
Tchernobill  [developer] Jun 13, 2021 @ 4:55am
Any problem with this mod ? That's the place to find a solution.
Please post here for each problem:
The Context (the game version, TweakItem calls, the actions done - mainly: load / start / stop-),
The Current State (what happend that is a problem, the console.txt log file unless you are sure it is not relevant),
The Expected state. (what should have happend)
Last edited by Tchernobill; Jul 6, 2021 @ 6:23am
< >
Showing 1-15 of 29 comments
Paranoid&Afraid Aug 12, 2021 @ 10:21pm 
For context, this was on Beta 41.50 IWBUMS.

This has been something that's been annoying me since this error permanently locks the game to the debug menu whenever I boot it up in debugging mode. Makes trying to debug stuff for other mods impossible.

The console log below should help describe what's going on, but in essence whenever it tries to do Category Display tweak called from CC's Better Sorting mod, it thinks the mod's category names don't exist at all. I've checked CC's other mods and any other mod that uses a copy of the ItemTweaker API (that is to say, only OGSN's stuff) and they function just fine. It seems that the error is specific to Better Sorting's Item_Categories.lua file since the mod's other lua that tweaks the name hasn't puked up any errors.

I also made sure the game loads the API last, moved Better Sorting's local ItemTweaker_Copy_CC.lua file so it doesn't end up overwriting your version, and even had changed the lua's dependency to ItemTweaker_Core.lua.

So far, nothing. Its really bizarre. I'm hoping you have something to say about this and apologies if this ends up wasting your time in the end.

LOG : General , 1628830892117> ------------------------------------------------------------- attempted index: DisplayCategory of non-table: null LOG : General , 1628830892118> ----------------------------------------- STACK TRACE ----------------------------------------- function: tweakItems -- file: ItemTweaker_Core.lua line # 62 ERROR: General , 1628830892119> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: DisplayCategory of non-table: null at KahluaThread.tableget line:1689. ERROR: General , 1628830892119> DebugLogStream.printException> Stack trace: java.lang.RuntimeException: attempted index: DisplayCategory 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.pcallvoid(KahluaThread.java:1812) at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66) at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139) at zombie.Lua.Event.trigger(Event.java:37) at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:50) at zombie.GameWindow.enter(GameWindow.java:709) at zombie.GameWindow.run_ez(GameWindow.java:602) at zombie.GameWindow.mainThread(GameWindow.java:464) at java.lang.Thread.run(Thread.java:745) LOG : General , 1628830892122> ----------------------------------------- STACK TRACE ----------------------------------------- function: tweakItems -- file: ItemTweaker_Core.lua line # 62 LOG : General , 1628830892122> LOG : General , 1628830892368> creating new sourcewindow: C:/Program Files (x86)/Steam/steamapps/workshop/content/108600/2510747487/mods/Item Tweaker API B41/media/lua/client/ItemTweaker_Core.lua
Tchernobill  [developer] Aug 13, 2021 @ 2:19pm 
Thanx for the details, this is the detail level modders need to improve their mods, in this case improve the compatibility. I handled it in version 1.9 and tested it OK in B41.50 with Better Sorting https://steamcommunity.com/sharedfiles/filedetails/?id=2313387159 .
Paranoid&Afraid Aug 15, 2021 @ 1:57pm 
Originally posted by Tchernobill:
Thanx for the details, this is the detail level modders need to improve their mods, in this case improve the compatibility. I handled it in version 1.9 and tested it OK in B41.50 with Better Sorting https://steamcommunity.com/sharedfiles/filedetails/?id=2313387159 .

Dude, you're welcome. Its good to know that the details I left in is helpful and from my heart, THANK YOU!

Good lord that error was driving me nuts especially since it kept crashing debug at start, so I couldn't debug ♥♥♥♥ at all.

But yeah, you're welcome and thank you for putting your time into this!
Spyware006 Aug 26, 2021 @ 3:22pm 
i have this
-----------------------------------------
Callframe at: DoParam
function: tweakItems -- file: ItemTweaker.lua line # 16

ERROR: General , 1630016282638> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor44.invoke.
ERROR: General , 1630016282638> DebugLogStream.printException> Stack trace:
java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:188)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
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.pcallvoid(KahluaThread.java:1812)
at se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:66)
at se.krka.kahlua.integration.LuaCaller.protectedCallVoid(LuaCaller.java:139)
at zombie.Lua.Event.trigger(Event.java:38)
at zombie.Lua.LuaEventManager.triggerEvent(LuaEventManager.java:61)
at zombie.core.Core.ResetLua(Core.java:3970)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
at se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:198)
at se.krka.kahlua.integration.expose.MultiLuaJavaInvoker.call(MultiLuaJavaInvoker.java:60)
at se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:182)
at se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:1007)
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.pcallBoolean(KahluaThread.java:1924)
at se.krka.kahlua.integration.LuaCaller.protectedCallBoolean(LuaCaller.java:104)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1215)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1173)
at zombie.ui.UIElement.onMouseUp(UIElement.java:1173)
at zombie.ui.UIManager.update(UIManager.java:782)
at zombie.GameWindow.logic(GameWindow.java:249)
at zombie.core.profiling.AbstractPerformanceProfileProbe.invokeAndMeasure(AbstractPerformanceProfileProbe.java:71)
at zombie.GameWindow.frameStep(GameWindow.java:726)
at zombie.GameWindow.run_ez(GameWindow.java:628)
at zombie.GameWindow.mainThread(GameWindow.java:471)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.security.InvalidParameterException: Error: Type = Drainable, is not a valid parameter in item: Sugar
at zombie.scripting.objects.Item.DoParam(Item.java:2942)
... 39 more

last PZ version. and... 136 mods xd but no other issues
Last edited by Spyware006; Aug 26, 2021 @ 3:24pm
Tchernobill  [developer] Aug 26, 2021 @ 3:42pm 
@Spyware006 your log does not refer to this mod. look for the file ItemTweaker.lua in your mods.
Nonetheless one of your other mods probably calls TweakItem(.."Drainable,"..)
and should instead call: TweakItem(.."Drainable"..)
i.e. without the ",". but I may be wrong on this, so refer to the other mod you use for tweaking item.
Last edited by Tchernobill; Aug 26, 2021 @ 3:43pm
Spyware006 Aug 27, 2021 @ 6:09am 
oh sorry and thank you. I will check my mods. :)
fueledbyochd Oct 19, 2021 @ 11:23pm 
Hello, Sorry to bug you, but i'm using the line

TweakItem("Base.BookMetalWelding5","DisplayName", "Metal Working - Master");

It shows it applies
LOG : General , 1634710752810> Base.BookMetalWelding5: displayname, Master Metalwork => Metal Working - Master

In game it doesn't show, and i added a line to your script to check paramater right after and i'm getting

LOG : General , 1634710752811> Base.BookMetalWelding5: displayname now equals Master Metalwork

PS Line added =
ItemTweaker_Core.lua
Line Num: 86
Lines:
local itemValue = getItemPropertyValue(item,property);
print(itemName .. ": " .. property .. " now equals " .. itemValue);

Any help would be amazing
fueledbyochd Oct 19, 2021 @ 11:55pm 
Nvm I found that the problem is coming directly from translation system
ArpyClarkson Dec 1, 2021 @ 2:25pm 
Hey man, having an issue with one of my mods using ItemTweaker; it's working just fine when I'm running the original ItemTweaker by DarkSlayerEX, but the tweaking code never runs when running with your version of ItemTweaker- any ideas?

The code i'm running is:
TweakItem("Base.Bag_Satchel", "ClothingItemExtra", "Bag_Satchel")
TweakItem("Base.Bag_Satchel", "ClothingItemExtraOption", "FannyPack_WearBack")
TweakItem("Base.Bag_Satchel", "BodyLocation", "Back2")
TweakItem("Base.Bag_Satchel", "CanBeEquipped", "FannyPackBack")

Which is working with the original ItemTweakAPI as seen in game and in the log:
LOG : General , 1638385898784> Base.Bag_Satchel: ClothingItemExtra, ? => Bag_Satchel.
LOG : General , 1638385898784> Base.Bag_Satchel: ClothingItemExtraOption, ? => FannyPack_WearBack.
LOG : General , 1638385898784> Base.Bag_Satchel: BodyLocation, ? => Back2.
LOG : General , 1638385898784> Base.Bag_Satchel: CanBeEquipped, ? => FannyPackBack.

However, this is not working in your version- with no tweaks whatsoever in the log.
Tchernobill  [developer] Dec 2, 2021 @ 7:21am 
@ArpyClarkson
I see 2 potential explanations but there may be others:
- you do not yet know that items are modified by mods only if the mod is active BEFORE the item is generated. It should not change an item that you already have.
- you do not have activated the mod when you think you have.
The best test is to activate the mod, then stop and start the game, then create a new game with the mod active, then find the item, then ensure it has the properties you want it to have.
If with this procedure it works on vanilla version and not on mine please insist here.
But I think both behave the same on that point with that procedure.
ArpyClarkson Dec 2, 2021 @ 8:57am 
Well I gave it another try; new game and ensured that my mod is active- which it is- but still no luck. This time It looks like your ItemTweaker is throwing some errors:

LOG : General , 1638463149650> ------------------------------------------------------------- attempted index: size of non-table: null. LOG : General , 1638463149652> ----------------------------------------- STACK TRACE ----------------------------------------- function: convertArrayToString -- file: ItemTweaker_Core.lua line # 30 function: tweakItems -- file: ItemTweaker_Core.lua line # 67. ERROR: General , 1638463149652> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: size of non-table: null at KahluaThread.tableget line:1689.. ERROR: General , 1638463149653> DebugLogStream.printException> Stack trace:. LOG : General , 1638463149654> ----------------------------------------- STACK TRACE ----------------------------------------- function: convertArrayToString -- file: ItemTweaker_Core.lua line # 30 function: tweakItems -- file: ItemTweaker_Core.lua line # 67. LOG : General , 1638463149654> . LOG : General , 1638463149702> creating new sourcewindow: G:/Steam/steamapps/workshop/content/108600/2510747487/mods/Item Tweaker API B41/media/lua/client/ItemTweaker_Core.lua. LOG : General , 1638463158717> ----------------------------------------- STACK TRACE ----------------------------------------- Callframe at: playUISound function: onMouseUp -- file: ISTickBox.lua line # 179. ERROR: General , 1638463158717> ExceptionLogger.logException> Exception thrown java.lang.reflect.InvocationTargetException at NativeMethodAccessorImpl.invoke0 (Native Method).. ERROR: General , 1638463158717> DebugLogStream.printException> Stack trace:.

And then again I got some more errors once I was in game:
LOG : General , 1638463227516> ------------------------------------------------------------- attempted index: size of non-table: null. LOG : General , 1638463227516> ----------------------------------------- STACK TRACE ----------------------------------------- function: convertArrayToString -- file: ItemTweaker_Core.lua line # 30 function: tweakItems -- file: ItemTweaker_Core.lua line # 67. ERROR: General , 1638463227516> ExceptionLogger.logException> Exception thrown java.lang.RuntimeException: attempted index: size of non-table: null at KahluaThread.tableget line:1689.. ERROR: General , 1638463227516> DebugLogStream.printException> Stack trace:. LOG : General , 1638463227517> ----------------------------------------- STACK TRACE ----------------------------------------- function: convertArrayToString -- file: ItemTweaker_Core.lua line # 30 function: tweakItems -- file: ItemTweaker_Core.lua line # 67. LOG : General , 1638463227517> .

Again, both my mod and ItemTweaker are loaded, and are the only mods loaded.
LOG : Mod , 1638463143593> loading ItemTweakerAPI. LOG : Mod , 1638463143594> loading satchelwithbagsIT.
Tchernobill  [developer] Dec 2, 2021 @ 9:14am 
Thanx a lot. This is corrected in version 1.10.
Last edited by Tchernobill; Dec 2, 2021 @ 9:42am
Lutter Dec 3, 2021 @ 11:16am 
Interesting fact, but after the last update of your ItemTweaker mod, there are some strange problems with above mentioned Satchel mod - it seems like something must have changed, because the options to wear satchel in context menu are non-existing - yet i can still wear them by double-clicking on them in inventory.

Second thing - Satchel Weight Reduction mod also stopped working, altough is loaded just fine.
Tchernobill  [developer] Dec 3, 2021 @ 11:22am 
@Lutter contextual menu is specific to satchel mod and I guess has no link with this mod. read the satchel mod description and if you're not satisfied, ask the satchel mod owner.

for the second thing, try with a new game. Modified item definition (includes the weight reduction) is set at item discovery time. This is specified in this mod's description and most modders specify it.
Lutter Dec 3, 2021 @ 12:20pm 
Originally posted by Tchernobill:
@Lutter contextual menu is specific to satchel mod and I guess has no link with this mod. read the satchel mod description and if you're not satisfied, ask the satchel mod owner.

for the second thing, try with a new game. Modified item definition (includes the weight reduction) is set at item discovery time. This is specified in this mod's description and most modders specify it.

I've run new game, so it's not the issue - altought i'll try to make some more tests, with just the Satchel mods (both mods form Arpy, to wear satchel with bags and to give satchel more reduction) plus item tweaker, everything works just fine, so i guess one of other mods received some "stealth update" i just need to figure out which one of those 100+ mods does this...

Thank you for reply and sorry for trouble, next time i will check more things before reporting something that might not be related to the mod.
< >
Showing 1-15 of 29 comments
Per page: 1530 50