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")
I don't know if the object table has a function for it, but this should work: world.getObjectParameter(entity.id(), "dyeEngine")
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)) end return { recipes = recipes, config = itemConfig.windowConfig } end 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) end end return recipe end 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) then return true end end 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] end if not itemConfig.allowed(itemName, itemTypeConfig) then return {} end local itemDefault = itemTypeConfig.default or {} local itemSpecial = (itemTypeConfig.special or {})[itemName] or {} if type(itemSpecial) == "string" then itemSpecial = (itemTypeConfig.specialSets or {})[itemSpecial] or {} end local itemConfig = {} for k,v in pairs(globalDefault) do itemConfig[k] = v end for k,v in pairs(itemDefault) do itemConfig[k] = v end for k,v in pairs(itemSpecial) do itemConfig[k] = v end return itemConfig end function init(virtual) if virtual then return end object.setInteractive(true) storage.config = world.getObjectParameter(entity.id(), "dyeEngine") end 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." } } end 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." } } end return {"OpenCraftingInterface", interactionConfig} end
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 <ctrl>+<f> click on "find in files" tab "find what :" Code: entity.configParameter "replace with :" Code: config.getParameter "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
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)
guys still need help with this. does the whole need total rewrite? from what i can tell not much changed in sb from beta to 1.0, so im hoping its some little things that need to be fixed btw im not planning on redistributing the thing
To be honest, I think the easiest way would be to re-create the proper recolored objects (only a few of them actually have the proper variants in the .png file), re-create or .patch each of their .frames files. I doubt augments can be used on placed objects, so it'd probably be better to create separate furniture-dyes, or a simple tool meant for coloring objects. For my part, I think meddling with the M.M. is probably more problematic than just creating a new tool. Then, they can probably all use the same .animation file and .lua file using something bk3k recently explained to me. At the start of said animation file: Code: { "globalTagDefaults" : { "myColor" : "default" }, In the animation file under "parts", the image is set up like this: Code: "image" : "<partImage>.<myColor>.<frame>" Finally, the LUA script simply uses "animator.setGlobalTag("myColor", "string")" to set the "myColor" Tag to the color names matching those in the .frames file.
making tool is a separate thread, this one is for simply figuring out why dyemod isnt working anymore. i mean it used to work fine... just in case, one of the latest working versions is here http://community.playstarbound.com/threads/dye-mod.63556/page-16#post-2589377 u need to delete all dyes to make it work (/dyemod/items/generic/other)
Hold on, I didn't mean to say its all useless ^^ DyeMod seems to have made use of about every possible way to color things, and I have to say most of it is definitely way above my head. What I meant to say is the regular use of dyes as an item has seemingly changed too much to be salvage-able, but the rest should be fine if all LUA errors can be figured out. I suppose "world.itemType" was simply replaced, as it doesnt exist in the default game and only in the itemconfig.lua When exactly does this error message come up? After all, the mod has many different methods and we need to know which you are trying.
i dont think dyes were ever a part of colouring objects (but not 100% sure) dyes were used for armors and all that, but objects seemed to be working separately. i tried getting rid of the things that dont relate to objects, but ive no idea which script does what (theres like 7 of them) on unrelated note, there was a neat feature of changing blocks hue (i think there was 16 or so variants)
the error message 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> 3rd post from the top
I saw, I was wondering when exactly during your attempt to use it, it appears, but I grabbed the mod and brought it to the same state. Anyhow: "world.itemType(itemName)" should now be "root.itemType(itemName)" if i'm not mistaken. Next error relates to the itemconfig: Code: [19:02:14.659] [Error] Exception while invoking lua function 'onInteraction'. (LuaException) Error code 2, [string "/objects/dyeengine/scripts/itemConfig.lua"]:20: attempt to index a nil value (local 'config') stack traceback: [C]: in metamethod '__index' [string "/objects/dyeengine/scripts/itemConfig.lua"]:20: 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>
Anyway, once you or others or I figure out more, You can have whatever you need from this tool I'm gonna add to my mod soon: It might be a much simpler solution
ah this looks yum im pretty hopeless at this, i mean [C]: in metamethod '__index' what the hell is this?? i remember the old json system used __merge, but it is lua, so i dont even...
I'm not good at explaining these things, but __index basically isn't needed here. The error message simply tells us that line 20 failed to get any kind of value it can use - meaning "nil". Here's an example from my coloring scripts: Code: if storage.animstate == nil then storage.animstate = 1 end In the Init function - it's pretty self-explanatory. My script checks if storage.animstate exists or not, and if it doesn't, it sets it to 1. If I remove this line, it'll give the same error message as above because my Update function immediately tries to use storage.animstate - so right after placing the object, the script errors and gets stuck because there's no storage.animstate. In the case of dyemod, some part of the itemconfig and the local variable config is either missing, or it is defined in a wrong way. Unfortunately, I never worked with item configs and item descriptors before so I'd also take time to check through it first.