Jump to content

Recommended Posts

Using a simple custom recipe in modmain with the prefab "mermhouse" such as :

Recipe("mermhouse", {Ingredient("boards", 8), Ingredient("cutstone", 6), Ingredient("fish", 16)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO, "mermhouse_placer")

 

Causes the game to crash when scrolling to the recipe in chosen recipe tab

../data/scripts/widgets/text.lua:55: calling 'SetString' on bad self (string expected, got table)
LUA ERROR stack traceback:
    =[C]:-1 in (method) SetString (C) <-1--1>
    ../data/scripts/widgets/text.lua:55 in (method) SetString (Lua) <53-56>
    ../data/scripts/widgets/recipepopup.lua:268 in (method) Refresh (Lua) <153-301>
    ../data/scripts/widgets/recipepopup.lua:307 in (method) SetRecipe (Lua) <304-308>
    ../data/scripts/widgets/craftslot.lua:168 in (method) Refresh (Lua) <117-173>
    ../data/scripts/widgets/craftslot.lua:177 in (method) SetRecipe (Lua) <175-179>
    ../data/scripts/widgets/crafting.lua:137 in (method) UpdateRecipes (Lua) <97-158>
    ../data/scripts/widgets/crafting.lua:178 in (method) ScrollUp (Lua) <174-183>
    ../data/scripts/widgets/crafting.lua:31 in (field) onclick (Lua) <31-31>
    ../data/scripts/widgets/button.lua:37 in (method) OnControl (Lua) <20-45>
    ../data/scripts/widgets/widget.lua:112 in (field) OnControl (Lua) <106-116>
    ../data/scripts/widgets/crafting.lua:161 in (method) OnControl (Lua) <160-172>

 

Is there a way to fix it ?

 

Edited by waw
Wrong CP

@Mobbstar It was a wrong copy paste, I've just edited my post

If you want to test : modmain.lua
 

local _G = GLOBAL
_G.STRINGS.RECIPE_DESC.MERMHOUSE = "Test recipe"
_G.Recipe("mermhouse", {_G.Ingredient("twigs", 1)}, _G.RECIPETABS.TOWN, _G.TECH.NONE)

--> Crashing

local _G = GLOBAL
_G.STRINGS.RECIPE_DESC.SLURTLEHOLE = "Test recipe"
_G.Recipe("slurtlehole", {_G.Ingredient("twigs", 1)}, _G.RECIPETABS.TOWN, _G.TECH.NONE)

--> Not crashing

Edited by waw

It might have to do with STRINGS.NAMES.MERMHOUSE being a table rather than a value, without "GENERIC" field:

MERMHOUSE =
{
    BASE = "Mermhouse",
    SW = "Merm Hut",
},

Try this before the recipe:

_G.STRINGS.NAMES.MERMHOUSE.GENERIC = "Mermhouse"

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
×
  • Create New...