Search the Community
Showing results for tags 'debug'.
Found 1 result
Hello all. I have a few interesting lines of code in my mod Show Me: local MAIN_VAR_NAME = 'net_ShowMe_chest'; local NETVAR_NAME = 'ShowMe_chest'; local EVENT_NAME = 'ShowMe_chest_dirty'; I use these constants in the code. But recently I decided to change values a little. And the hell began... Case 1: local MAIN_VAR_NAME = 'net_ShowMe_chest1'; local NETVAR_NAME = 'ShowMe_chest1'; local EVENT_NAME = 'ShowMe_chest_dirty1'; Looks fine, but I have many mods installed and somehow it causes a crash (mouseover on Crock Pot and may be other actions): [string "scripts/componentactions.lua':535: attempt to inder a nil value LUA ERROR stack traceback: scripts/componentactions.lua:1535 in (method) CollectActions (Lua) <1521-1547> scripts/components/playeractionpicker.lua:102 in (method) GetSceneActions (Lua) <99-124> scripts/components/playeractionpicker.lua:249 in (method) GetLeftClickAction (Lua) <202-273>7 scripts/components/playeractionpicker.lua:388 in (method) DoGetMouseActions (Lua) <338-392> scripts/components/playecontroller.lua:1895 in (method) OnUpdate (Lua) <1758 2177> scripts/update.lua:202 in () ? (Lua) <159-238> or [00:04:34]: [string "scripts/componentactions.lua"]:1535: attempt to index a nil value LUA ERROR stack traceback: scripts/componentactions.lua:1535 in (method) CollectActions (Lua) <1521-1547> self (valid:true) = People was sending me their crash reports and I was not able to understand what's wrong. It was very long quest to figure out that exact these changes are the reason of the crash. And I was surprised. But OK, I changed it a bit more and the crash has left: local MAIN_VAR_NAME = 'net_ShowMe_chst'; local NETVAR_NAME = 'ShowMe_chst'; local EVENT_NAME = 'ShowMe_chst_dirty'; I still can't belive that such fix can help. But this is real. Also I noticed that my feature (highlighted chests) stop working for Crock Pot. So this not real fix. Later crash came back for these valuse. Step to reproduce: 1) Install mods: Show Me (change vars to these valuse), Smarter Crock Pot, Quick Drop. 2) Start a game with caves. 3) Put a berrie in a Crock Pot. 4) Mouse over the Crock Pot. I'm not sure if you can reproduce crash too. But it worked for me on my computer. It was the same crash with action components. I decided that's easy to find a place with error step by step. So I started from simplest mod - Quick Drop. I removed many pieces of code and each time I started the game and got crash again. Then I removed ALL the code from Quick Drop and... got crash again. What? Really. I started thinking that I'm going crazy. Let's take a closer look. There is an EMPTY mod that causes the crash. Let's check again. 1) If I turn the mod off, there is no crash (with mods Show Me + Smarter Crock Pot). If I turn mod on, crash appears. 2) Okay, may be I mixed files or mods. I added to modmain.lua a line print("Hello from Star!") - and I found it both in the server log and in the client! So exact empty mod causing the crash. 3) Okay, may be I'm missing something... Secret symbols in modinfo or whatever. I removed ALL files and subfolders and created modinfo and modmain from scratch (keeping only version number to prevent updating). But everything other was not the same, even mod name. But mod still caused the crash. 4) Okay, I disabled mod; Quit the DST; Renamed folder of the mod. Started the DST. Enabled the mod (with the same name but in another folder). And now don't cause the crash. Finally! But what is was? The crash depends on folder name? Really? Note that AddComponentAction is not used in all of these three mods. So it's very strange why crash is about components. I decided to play with var names again and it helped: local MAIN_VAR_NAME = 'net_ShowMe_cht'; local NETVAR_NAME = 'ShowMe_cht'; local EVENT_NAME = 'ShowMe_cht_dirty'; No! No no no no... Not again! I don't believe that! Why it helped? How it may help? I just renamed some constants in the mod. Looks quite easy. If you got a crash, rename a constant. That's it! Really? But the issue has not gone. I know that it's still there. Because my feature is still not working for Crock Pot. My feature should highlight Crock Pot if there is berrie in Crock Pot AND in cursor of the player. Let's make a trick. Rename the constants to initial values: local MAIN_VAR_NAME = 'net_ShowMe_chest'; local NETVAR_NAME = 'ShowMe_chest'; local EVENT_NAME = 'ShowMe_chest_dirty'; Tada! Now all works fine. My feature works again. No crash, no conflicts (possibly). But can someone explain to me what is going on here? Why simple renaming of netvars cause such issues? Sadly, this is not the end of story because I keep receiving messages about crashes from other people. I think such bugs should be explained so other modders can solve them. I hope you can help me. May be it's time to summon devs, I'm not sure.