item with name '...' does not exist

Place to get help with not working mods / modding interface.
Post Reply
rldml
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sun Mar 06, 2016 2:38 am
Contact:

item with name '...' does not exist

Post by rldml »

Can someone help please:

Code: Select all

-- item.lua
local TrainStop = table.deepcopy(data.raw["train-stop"]["train-stop"])

TrainStop.name = "train-stop-alt"
--TrainStop.default_id_signal = {type = "virtual", name = "signal-S"}

local TrainStopRecipe = table.deepcopy(data.raw.recipe["train-stop"])
TrainStopRecipe.result = "train-stop-alt"

data:extend{TrainStop, TrainStopRecipe}
i get the error:
1.414 Error ModManager.cpp:957: Error in assignID, item with name 'train-stop-alt' does not exist.

Source: train-stop (recipe).
1.604 Loaded shader file D:/Steam/steamapps/common/Factorio/data/core/graphics/shaders/game.glsl
1.605 Loaded shader file D:/Steam/steamapps/common/Factorio/data/core/graphics/shaders/zoom-to-world.glsl
1.612 Initial atlas bitmap size is 4096
1.612 Created atlas bitmap 192x5
1.612 Created atlas bitmap 132x24
1.759 Sprites loaded
1.759 Convert atlas 132x24 to: trilinear-filtering
1.769 Custom inputs active: 0
1.780 Factorio initialised
1.781 Mods to disable:Fehler beim Laden der Mods: Error in assignID, item with name 'train-stop-alt' does not exist.
2nd question: How can i extend a well-kown data type like "train-stop"? I need an additional property named like above.

I've searched the forum and the wiki for the error message, but there are no hints. I've used the fire-armor-tutorial as base for my first step to get into the lua-coding of modifications.

Any help is appreciated.

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: item with name '...' does not exist

Post by Bilka »

Recipes produce items, not entities. You create an entity in the first part of your code. You'll also have to create the item to be able to make it the result of the recipe.

You can't extend prototypes. They have the properties they have and that's it.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

rldml
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sun Mar 06, 2016 2:38 am
Contact:

Re: item with name '...' does not exist

Post by rldml »

Bilka wrote:Recipes produce items, not entities. You create an entity in the first part of your code. You'll also have to create the item to be able to make it the result of the recipe.
Where i have to define which ressources are needed for my alternate train-stop?
You can't extend prototypes. They have the properties they have and that's it.
How do other people build completly new buildings with self defined properties (Bob's, Angels,...)? Is there really no way to extend a entity with new properties?

Sorry to bother you. I'm not completely new to programming (i have a lot experience in languages like C# and scripting environments like powershell). But LUA is that much bad documented crap, i don't get a step into the language without getting a huge bonk on the nose. All tutorials i found doing the same: adding an item like an armor to the game. I've tried to get into other addons, that do similar things i want to do. But they all do so much more than i want, it is impossible to filter just the things i need to know for the beginning.

An example is the data.raw-table: The wiki artikle https://wiki.factorio.com/Data.raw is not accurate. Look at the item heavy-armor: If you make a deepcopy, you get the item with data.raw.armor["heavy-armor"], if you use the wiki-artikle it should be data.raw.tool.armor["heavy-armor"]. Why is a copy of the actual data.raw-table not part of lua-api.factorio.com?

It's simply frustrating and i have no clue where to start... :(

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: item with name '...' does not exist

Post by Bilka »

rldml wrote: Where i have to define which ressources are needed for my alternate train-stop?
Do you mean the recipe? You already define that in your code bit. You don't define the item it produces, which is why you get the error. The item should just be accesible by data.raw.item["train-stop"]. Deepcopy it, rename it, put it into data, and you are good.
rldml wrote:How do other people build completly new buildings with self defined properties (Bob's, Angels,...)? Is there really no way to extend a entity with new properties?
They change properties. But you cannot add new ones. A electric pole for example can't have an inventory etc. You can change the animation of building or they size etc. as long as they originally have that property.
rldml wrote:Sorry to bother you. I'm not completely new to programming (i have a lot experience in languages like C# and scripting environments like powershell). But LUA is that much bad documented crap, i don't get a step into the language without getting a huge bonk on the nose. All tutorials i found doing the same: adding an item like an armor to the game. I've tried to get into other addons, that do similar things i want to do. But they all do so much more than i want, it is impossible to filter just the things i need to know for the beginning.
That's not a lua problem :P The problem is more that the protoype phase isn't very well documented. I'm working on improving that, but it takes time. Most people just look at other mods, like you said.
rldml wrote:An example is the data.raw-table: The wiki artikle https://wiki.factorio.com/Data.raw is not accurate. Look at the item heavy-armor: If you make a deepcopy, you get the item with data.raw.armor["heavy-armor"], if you use the wiki-artikle it should be data.raw.tool.armor["heavy-armor"]. Why is a copy of the actual data.raw-table not part of lua-api.factorio.com?
The article is not wrong. It just lists the complete path to items so that you can see what properties they inherit. I've been debating changing that for a while now, so I guess I should lol. It's not part of that doc because that doc is mostly about the control phase. It doesn't document prototypes at all. The only prototype documentation we have is https://wiki.factorio.com/Prototype_definitions which is partly outdated and missing a lot of stuff.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13220
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: item with name '...' does not exist

Post by Rseding91 »

lua-api.factorio.com is the scripting language section of modding - it doesn't have anything about the prototype section which is what you're dealing with here.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”