←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

")" expected while there is a bracket

Hydrotronics's Photo Hydrotronics 11 May 2019

While I indeed expect to be blasted by people with this ugly, hardly readable line of code I'm about to barf here, I am having a problem.

I am creating a program to replace mobs with armoured mobs (Using a Command Computer). All data handling and such is done elsewhere in the code, and I have confirmed that it works and carries the correct information. However, the line I am using to actually spawn the new mob throws an unexpected error:
")" expected

I am confused about this. I see no syntax being broken. I would appreciate if somebody could explain what is going on here and why it is occurring

commands.exec(
"execute @e[type="..tag["Name"]..",tag=!enhanced] ~ ~ ~
/summon "..tag["Name"].." ~ ~ ~
{
ArmorItems:[
{Count:"..tag["Data"][1]["Count"]..",id:"..tag["Data"][1]["Item"].."},
{Count:"..tag["Data"][2]["Count"]..",id:"..tag["Data"][2]["Item"].."},
{Count:"..tag["Data"][3]["Count"]..",id:"..tag["Data"][3]["Item"].."},
{Count:"..tag["Data"][4]["Count"]..",id:"..tag["Data"][4]["Item"].."},
{}
],
ArmorDropChances:["..tag["Data"][1]["Chance"].."F,"..tag["Data"][2]["Chance"].."F,"..tag["Data"][3]["Chance"].."F,"..tag["Data"][4]["Chance"].."F],
Tags:[\"enhanced\"]}")

I put it in a pastebin for if you needed a single line

Thanks in advance

Edit: Forgot to add an F

Edit2: Here is the function associated with this line
Edited by Hydrotronics, 12 May 2019 - 08:35 AM.
Quote

Lyqyd's Photo Lyqyd 11 May 2019

Please post the entire code.
Quote

Purple's Photo Purple 12 May 2019

Indeed. The error you are getting is that somewhere in the code you are missing a ). Which can very well be happening just above your line and than your line is just reporting it.
Quote

Hydrotronics's Photo Hydrotronics 12 May 2019

Added the function being made with the problematic code
Quote

Lupus590's Photo Lupus590 12 May 2019

Line 15 in the pastebin has a ] instead of ) on the end
Quote

Hydrotronics's Photo Hydrotronics 12 May 2019

oh. Loading up my game again, I can indeed see it was saying that line. I must have read it wrong somehow.. Sorry for such a silly post, then ^^; But thank you for pointing this out to me
I was looking at lines 13 and up, because I thought it said that line for some reason.

Fixing that does conclude this part of the code, as well, so thank you
Quote