1. Hey Guest! Stardew Valley is now available on Xbox One and PlayStation 4!
    Dismiss Notice

Modding Help Trying to revive DyeMod, need folks with lua knowledge.

Discussion in 'Starbound Modding' started by mastercookie, Feb 16, 2017 at 6:04 PM.

  1. mastercookie

    mastercookie Scruffy Nerf-Herder

    me again... basically what the title says. Currently the game runs with dyemod but its gives the error:

    Exception while calling script init: (LuaException) Error code 2, [string "/objects/dyeengine/dyestation/dyestation.lua"]:4: attempt to call a nil value (field 'configParameter')
    stack traceback:
    [C]: in field 'configParameter'
    [string "/objects/dyeengine/dyestation/dyestation.lua"]:4: in function <[string "/objects/dyeengine/dyestation/dyestation.lua"]:1>

    and the line looks like this:

    storage.config = entity.configParameter("dyeEngine")
  2. Errors4l

    Errors4l Existential Complex

    I don't know if the object table has a function for it, but this should work: world.getObjectParameter(entity.id(), "dyeEngine")
    mastercookie likes this.
  3. mastercookie

    mastercookie Scruffy Nerf-Herder

    neat, it shows pop up message now. but still not working, the current error is this:

    [Error] Exception while invoking lua function 'onInteraction'. (LuaException) Error code 2, [string "/objects/dyeengine/scripts/itemConfig.lua"]:18: attempt to call a nil value (field 'itemType')
    stack traceback:
    [C]: in field 'itemType'
    [string "/objects/dyeengine/scripts/itemConfig.lua"]:18: in field 'get'
    [string "/objects/dyeengine/scripts/dyeEngine.lua"]:4: in field 'all'
    [string "/objects/dyeengine/dyestation/dyestation.lua"]:14: in function <[string "/objects/dyeengine/dyestation/dyestation.lua"]:8>

    ill just post the whole things:

    dyeEngine = {}

    function dyeEngine.all(config, itemName)
    local itemConfig = itemConfig.get(config, itemName)
    if not itemConfig.method then return {} end

    local recipes = {}

    for _,color in ipairs(config.colors) do
    recipes = concatTable(recipes, dyeEngine[itemConfig.method](itemName, color, itemConfig))

    return { recipes = recipes, config = itemConfig.windowConfig }

    function dyeEngine.genericRecipe(itemName, color, itemConfig)
    local recipe = {
    input = {
    { item = itemName, count = itemConfig.amount }
    output = {
    item = itemName,
    count = itemConfig.amount
    groups = color.groups

    if not itemConfig.free then
    local dyes = color.dyes or { color.name.."dye" }

    for _,dye in ipairs(dyes) do
    table.insert(recipe.input, dye)

    return recipe

    itemConfig = {}

    function itemConfig.allowed(itemName, itemTypeConfig)
    local whitelist = itemTypeConfig.whitelist or {}
    local blacklist = itemTypeConfig.blacklist or {}

    if (isEmpty(whitelist)
    or inTable(whitelist, itemName))
    and not inTable(blacklist, itemName)
    return true

    function itemConfig.get(config, itemName)
    local itemType = world.itemType(itemName)

    local globalDefault = config.default or {}

    local itemTypeConfig = config[itemType] or {}
    if type(itemTypeConfig) == "string" then
    itemTypeConfig = config[itemTypeConfig]

    if not itemConfig.allowed(itemName, itemTypeConfig) then
    return {}

    local itemDefault = itemTypeConfig.default or {}

    local itemSpecial = (itemTypeConfig.special or {})[itemName] or {}
    if type(itemSpecial) == "string" then
    itemSpecial = (itemTypeConfig.specialSets or {})[itemSpecial] or {}

    local itemConfig = {}

    for k,v in pairs(globalDefault) do
    itemConfig[k] = v
    for k,v in pairs(itemDefault) do
    itemConfig[k] = v
    for k,v in pairs(itemSpecial) do
    itemConfig[k] = v

    return itemConfig

    function init(virtual)
    if virtual then return end
    storage.config = world.getObjectParameter(entity.id(), "dyeEngine")

    function onInteraction(args)
    local itemName = world.entityHandItem(args.sourceId, "primary")
    if not itemName then
    return { "ShowPopup", { message = "I should hold the item that I want to dye." } }

    local interactionConfig = dyeEngine.all(storage.config, itemName)
    interactionConfig.recipes = reverse(interactionConfig.recipes or {})

    if isEmpty(interactionConfig.recipes) then
    return { "ShowPopup", { message = "I can not dye that item." } }

    return {"OpenCraftingInterface", interactionConfig}

  4. bk3k

    bk3k Existential Complex

    Make sure you have permission before you consider distributing it. Learning from it and making your own is another matter of course. Let me get you started. That must be pre-1.0

    Assuming you have notepad++ or another advanced text editor? I'll give you the notepad++ directions
    click on "find in files" tab
    "find what :"
    "replace with :"
    "directory :"
    whatever folder you have the mod in

    click on "replace in files"

    That will trade out every instance. This is a useful feature but use it carefully(very specific strings only) or you'll accidentally replace something you didn't intend. You can also limit the file type to *.lua

    Something I saved from the "1.0 is coming" thread
    and from 1.2
  5. mastercookie

    mastercookie Scruffy Nerf-Herder

    we already fixed entity.configParameter, it's itemType error ive no idea what to do with.

    in itemconfig.lua it's this one (i think):

    function itemConfig.get(config, itemName)
    local itemType = world.itemType(itemName)

    in dyeengine.lua:

    function dyeEngine.all(config, itemName)
    local itemConfig = itemConfig.get(config, itemName)

Share This Page