How can I multiply only ingredient amount and not crashing the mod (Coding Problem)

Topics and discussion about specific mods
nattanang
Burner Inserter
Burner Inserter
Posts: 11
Joined: Tue Nov 12, 2024 9:57 am
Contact:

How can I multiply only ingredient amount and not crashing the mod (Coding Problem)

Post by nattanang »

This mod crash because all 3 types of ingredient input is multiply by local cost multiplier, causing crash in line 42 of the code.
My question is how can I multiply only "Ingredient Amount" input by local cost multiplier without crashing the mod
Thanks in advanced
Attachments
ภาพหน้าจอ (269).png
ภาพหน้าจอ (269).png (44.42 KiB) Viewed 197 times
ภาพหน้าจอ (271).png
ภาพหน้าจอ (271).png (277.08 KiB) Viewed 197 times
Wretlaw-Beacon-Rebalance.zip
(1.84 MiB) Downloaded 20 times
robot256
Smart Inserter
Smart Inserter
Posts: 1164
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: How can I multiply only ingredient amount and not crashing the mod (Coding Problem)

Post by robot256 »

You are getting the error on line 42 because it is trying to read the ingredients tables that you added on line 31. You added them with "type" as a named field in the table, but name and amount are given positionally so they are actually [1] and [2] respectively. You need to specify them as "name=ingredient.name" and "amount=ingredient.amount*cost_multiplier" on both line 31 and line 42 for it to work and to maintain consistency.
Post Reply

Return to “Mods”