Jump to content

Crash in latest version


Recommended Posts

I realized I posted this in the wrong forum. Should have been in the Together Beta forums...

 

Anyway, since the latest version my mod crashes on startup and I haven't been able to figure out why.

 

 

@RedMattis Hmm. Have you exported the mod environment in modmain?

GLOBAL.package.loaded["seras.modenv"] = env

 

Still not getting it to work. It seems to load the environment though, because the modenv contains the data I presume it needs. Log with a print for the table below:

[00:00:05]: Mod: Seras    Registering prefabs    [00:00:05]: Mod: Seras     Registering prefab file: prefabs/seras    [00:00:05]: table: 0E74B820    [00:00:05]: PrefabFiles    table: 0E41D960    [00:00:05]: string    table: 09887130    [00:00:05]: Assets    table: 0E74CD10    [00:00:05]: RegisterPrefabs    function: 098C2B20    [00:00:05]: tostring    function: 0973BF60    [00:00:05]: print    function: 0988F1D8    [00:00:05]: AddGameMode    function: 0E5206C8    [00:00:05]: LoadPrefabFile    function: 098C2B40    [00:00:05]: Prefabs    table: 0F0DC248    [00:00:05]: modname    Seras    [00:00:05]: table    table: 098870E0    [00:00:05]: GetModConfigData    function: 0E74BB18    [00:00:05]: CHARACTERLIST    table: 0E74B870    [00:00:05]: AddAction    function: 0E74BC30    [00:00:05]: modinfo    table: 0E74A470    [00:00:05]: postinitdata    table: 0E74B988    [00:00:05]: AddLevel    function: 0E520668    [00:00:05]: pairs    function: 083EFDB0    [00:00:05]: TUNING    table: 09969330    [00:00:05]: SendModRPCToServer    function: 0E520808    [00:00:05]: AddPrefabPostInitAny    function: 0E74BE60    [00:00:05]: AddModRPCHandler    function: 0E5207E8    [00:00:05]: AddTaskPreInit    function: 0E74BAA0    [00:00:05]: GLOBAL    table: 08540478    [00:00:05]: AddReplicableComponent    function: 0E5207C8    [00:00:05]: AddSimPostInit    function: 0E74BBB8    [00:00:05]: RemapSoundEvent    function: 0E5207A8    [00:00:05]: env    table: 0E74B820    [00:00:05]: LoadPOFile    function: 0E520788    [00:00:05]: Ingredient    table: 0E4D4DB8    [00:00:05]: Asset    table: 09A16C18    [00:00:05]: Prefab    table: 09A16998    [00:00:05]: Recipe    function: 0E520768    [00:00:05]: postinitfns    table: 0E74B960    [00:00:05]: AddGlobalClassPostConstruct    function: 0E74BBE0    [00:00:05]: AddModCharacter    function: 0E74BF28    [00:00:05]: Class    function: 098A4698    [00:00:05]: AddCookerRecipe    function: 0E74BF00    [00:00:05]: AddGamePostInit    function: 0E74BB68    [00:00:05]: AddClassPostConstruct    function: 0E74BC08    [00:00:05]: cookerrecipes    table: 0E74BED8    [00:00:05]: AddIngredientValues    function: 0E520748    [00:00:05]: AddBrainPostInit    function: 0E520728    [00:00:05]: math    table: 098871A8    [00:00:05]: AddPlayerPostInit    function: 0E520708    [00:00:05]: AddLevelPreInitAny    function: 0E74B9D8    [00:00:05]: AddRoomPreInit    function: 0E74BAF0    [00:00:05]: AddComponentPostInit    function: 0E74BE10    [00:00:05]: type    function: 0973BF80    [00:00:05]: modimport    function: 0E74B8E8    [00:00:05]: ipairs    function: 083EFD80    [00:00:05]: AddStategraphPostInit    function: 0E74BDC0    [00:00:05]: AddStategraphState    function: 0E74BD20    [00:00:05]: AddStategraphActionHandler    function: 0E74BC80    [00:00:05]: AddTask    function: 0E520688    [00:00:05]: AddComponentAction    function: 0E5206E8    [00:00:05]: AddMinimapAtlas    function: 0E74BCA8    [00:00:05]: AddPrefabPostInit    function: 0E74BEB0    [00:00:05]: AddLevelPreInit    function: 0E74BA00    [00:00:05]: MOD_RPC    table: 0E64AF18    [00:00:05]: AddRoom    function: 0E5206A8    [00:00:05]: MODROOT    ../mods/Seras/    [00:00:05]: AddStategraphEvent    function: 0E74BD70    [00:00:05]: error calling LoadPrefabFile in mod Seras:[string "scripts/modutil.lua"]:50: variable 'modname' is not declaredLUA ERROR stack traceback:=[C] in function 'error'scripts/strict.lua(23,1)scripts/modutil.lua(50,1) in function 'initprint'scripts/modutil.lua(152,1) in function 'GetModConfigData'../mods/Seras/scripts/prefabs/seras.lua(50,1) in function 'fn'scripts/mainfunctions.lua(94,1)=(tail call) ?=[C] in function 'xpcall'scripts/mods.lua(165,1)scripts/mods.lua(456,1) in function 'RegisterPrefabs'scripts/gamelogic.lua(166,1) in function 'LoadAssets'    ...=[C] in function 'GetPersistentString'scripts/saveindex.lua(90,1) in function 'Load'scripts/gamelogic.lua(1011,1) in function 'callback'scripts/playerprofile.lua(671,1) in function 'Set'scripts/playerprofile.lua(553,1)=[C] in function 'GetPersistentString'scripts/playerprofile.lua(551,1) in function 'Load'scripts/gamelogic.lua(1010,1) in main chunk=[C] in function 'require'scripts/mainfunctions.lua(685,1)    [00:00:05]: Disabling Seras because it had an error.   

seras.lua

-- more code abovelocal modenv = require "seras.modenv"print (modenv)for key,value in pairs(modenv) do print(key,value) endlocal easy = (modenv.GetModConfigData("seras_difficulty")=="easy")local normal = (modenv.GetModConfigData("seras_difficulty")=="normal")local serasDiet = (modenv.GetModConfigData("seras_diet"))-- more code below

I tried adding "GLOBAL.package.loaded["seras.modenv"] = env" to the top of my modmain, but it did no difference. When put in the seras. lua it complained that GLOBAL wasn't declared.

 

Link to comment
Share on other sites

@RedMattis, Lua complains that GLOBAL isn't declared because GLOBAL doesn't exist outside of modmain. Use _G instead (which is optional anyway because seras.lua is already in the global environment).

 

Though if your goal is using config data outside of modmain, there's an easier way of doing it. ;)

 

Thanks I got past that error with the method you provided. It seems to be breaking on the code to add a craft tab though. I got the code from the forum, but I assume Klei has changed something so it no longer works.

 

Code in modmain:

AddClassPostConstruct("widgets/crafttabs", function(class)    if class.owner:HasTag("serasV") then        local v = CUSTOM_RECIPETABS.VAMPIRIC        local k = #class.tab_order + 1        local tab_bg =        {            normal = "tab_normal.tex",            selected = "tab_selected.tex",            highlight = "tab_highlight.tex",            bufferedhighlight = "tab_place.tex",            overlay = "tab_researchable.tex",        }                class.tabs.spacing = 750/k        local tab = class.tabs:AddTab(STRINGS.TABS[v.str], resolvefilepath("images/hud.xml"), v.icon_atlas or resolvefilepath("images/hud.xml"), v.icon, tab_bg.normal, tab_bg.selected, tab_bg.highlight, tab_bg.bufferedhighlight, tab_bg.overlay,                    function() --select fn                if not class.controllercraftingopen then                                    if class.craft_idx_by_tab[k] then                        class.crafting.idx = class.craft_idx_by_tab[k]                    end                                        class.crafting:SetFilter(                        function(recipe)                            local rec = GLOBAL.AllRecipes[recipe]                            return rec and rec.tab == v                        end)                    class.crafting:Open()                end            end,                        function() --deselect fn                class.craft_idx_by_tab[k] = class.crafting.idx                class.crafting:Close()            end)        tab.filter = v        tab.icon = v.icon        tab.icon_atlas = v.icon_atlas or resolvefilepath("images/hud.xml")        tab.tabname = STRINGS.TABS[v.str]        class.tabbyfilter[v] = tab                table.insert(class.tab_order, tab)        end    end)

Crash:

[00:00:42]: [string "scripts/entityscript.lua"]:481: calling 'HasTag' on bad self (string expected, got boolean)LUA ERROR stack traceback:=[C]:-1 in (method) HasTag (C) <-1--1>scripts/entityscript.lua:481 in (method) HasTag (Lua) <480-482>   self (valid:true) =      GUID = 111546      inlimbo = false      DynamicShadow = DynamicShadow (281E7BC8)      ghostenabled = true      SetCameraDistance = function - scripts/prefabs/player_common.lua:927      ScreenFlash = function - scripts/prefabs/player_common.lua:981      EnableMovementPrediction = function - scripts/prefabs/player_common.lua:303      player_classified = 111547 - player_classified (valid:true)      playercolour = table: 1D2674E8      OnSleepIn = function - scripts/prefabs/player_common.lua:816      AnimState = AnimState (281E7D28)      worldstatewatching = table: 23D9C628      Light = Light (2432E670)      children = table: 2A51AF10      pendingtasks = table: 396BFA08      Network = Network (281EA508)      name = RedMattis      OnRemoveEntity = function - scripts/prefabs/player_common.lua:426      userid = KU_rcx2C0hm      OnPreLoad = function - ../mods/Seras/scripts/prefabs/seras.lua:474      LightWatcher = LightWatcher (281E7E28)      ShowHUD = function - scripts/prefabs/player_common.lua:921      sg = sg="wilson", state="talk", time=0.10, tags = "idle,talking,"      IsHUDVisible = function - scripts/prefabs/player_common.lua:911      inherentactions = table: 23D9E338      spawntime = 0.033333335071802      SetGhostMode = function - scripts/prefabs/player_common.lua:342      CanExamine = function - scripts/prefabs/player_common.lua:20      HUD = HUD      _OnSave = function - ../mods/Seras/scripts/prefabs/seras.lua:470      Transform = Transform (281E7888)      experience = 1050      SnapCamera = function - scripts/prefabs/player_common.lua:933      actionreplica = table: 396BF788      event_listening = table: 396BFB70      ScreenFade = function - scripts/prefabs/player_common.lua:974      actioncomponents = table: 396BF580      OnWakeUp = function - scripts/prefabs/player_common.lua:844      ShowActions = function - scripts/prefabs/player_common.lua:915      OnSetSkin = function - scripts/prefabs/player_common.lua:889      ShakeCamera = function - scripts/prefabs/player_common.lua:941      entity = Entity (09B7AC90)      OnLoad = function - scripts/prefabs/player_common.lua:794      prefab = seras      updatecomponents = table: 23D99A18      IsActionsVisible = function - scripts/prefabs/player_common.lua:905      AttachClassified = function - scripts/prefabs/player_common.lua:415      OnDespawn = function - scripts/prefabs/player_common.lua:862      persists = false      OnSave = function - scripts/prefabs/player_common.lua:785      MiniMapEntity = MiniMapEntity (281E7D48)      SoundEmitter = SoundEmitter (281E7C68)      Physics = Physics (281E9C28)      event_listeners = table: 396BFAA8      IsFreezing = function - scripts/prefabs/player_common.lua:57      soundsname = willow      strength = mighty      replica = table: 396BF5D0      DetachClassified = function - scripts/prefabs/player_common.lua:421      components = table: 396BF5A8      GetTemperature = function - scripts/prefabs/player_common.lua:47   tag = truescripts/components/builder.lua:341 in () ? (Lua) <339-342>   self =      bonus_tech_level = 0      accessible_tech_trees = table: 23D9BCF0      inst = 111546 - seras (valid:true)      recipes = table: 23D9BA98      _ = table: 23D9B9D0      buffered_builds = table: 396BF3F0   recname = smallblood_1   recipe = table: 1C8CD470=(tail call):-1 in ()  (tail) <-1--1>scripts/widgets/crafttabs.lua:244 in (method) DoUpdateRecipes (Lua) <218-317>   self =      callbacks = table: 1CBAB210      bg_cover = Image - images/hud.xml:craft_bg_cover.tex      inst = 111716 -  (valid:true)      focus = false      needtoupdate = false      children = table: 1CBAB170      parent = left_scale_root      focus_flow_args = table: 1CBAC188      focus_target = false      craft_idx_by_tab = [00:00:42]: SCRIPT ERROR! Showing error screen	[00:00:42]: stack traceback:	scripts/widgets/widget.lua:261 in (method) SetPosition (Lua) <256-265>	scripts/widgets/followtext.lua:45 in (method) OnUpdate (Lua) <37-47>	scripts/frontend.lua:610 in (method) Update (Lua) <465-630>	scripts/frontend.lua:663 in (method) PushScreen (Lua) <641-668>	scripts/frontend.lua:773 in (method) ShowScreen (Lua) <770-775>	scripts/frontend.lua:828 in (method) DisplayError (Lua) <824-837>	scripts/mainfunctions.lua:913 in () ? (Lua) <893-946>	[00:00:42]: Console_CreateRoom: roomName RedMattis's World created for id 109775241890616479
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...