tModLoader I need help with my mod

So in my mod I am making an item called sword of demons, and I tried to build it and it says "error CS1003: syntax error, ',' expected"


Screenshot (135).png



My code if it helps:

Screenshot (136).png
 
Kinda late reply but make sure that:
1. no spaces between recipe.AddIngredient and (ItemID.etc)
2. only 1 space between ItemID.22, and the 10
so like recipe.AddIngredient(ItemID.22, 10);

if you didn't know your error message has the line of code that had the problem, its the 2 numbers in brackets after the file name, which was (36, 30)
 
The issue appears to be on the 36th line, which is where the recipe's start.

Just for the future, the syntax error it gives tells you what line is the problem, as well as what the problem is. Usually syntax errors are super simple, like forgetting a ; or somethin. They'll probably occur often so its good to learn how to deal with them.
Syntax errors can also mean that there's a missing source (the using ____ bits at the top).

Anyway, Im not really sure how numerical IDs work within this specific context. So Im not sure if they can be used or not, but I would recommend internal names instead.
I think this should fix the problem.
Code:
public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddIngredient(ItemID.PaintingCursedSaint, 1);
            recipe.AddIngredient(ItemID.PalmWoodSword, 1);
            recipe.AddIngredient(ItemID.BrainOfConfusion, 1);
            recipe.AddIngredient(ItemID.WormScarf, 1);
            recipe.AddTile(TileID.Anvils); //Many crafting interfaces use plural terms here. Not sure if any.anvil also works. I've never tried it.
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
You can find the internal names on the Item IDs page on the Terraria wiki. Which is where I'd assume you got the item numerical IDs.
 
You can use the Item ID numbers!
You do not need to put ItemID in front of the ID number!
change it from
recipe.AddIngredient(ItemID.22, 10);
to
recipe.AddIngredient(22, 10);
 
Last edited:
Back
Top Bottom