This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Hydrotronics's profile picture

")" expected while there is a bracket

Started by Hydrotronics, 11 May 2019 - 08:27 PM
Hydrotronics #1
Posted 11 May 2019 - 10:27 PM
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 on 12 May 2019 - 07:35 AM
Lyqyd #2
Posted 12 May 2019 - 12:44 AM
Please post the entire code.
Purple #3
Posted 12 May 2019 - 09:15 AM
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.
Hydrotronics #4
Posted 12 May 2019 - 09:37 AM
Added the function being made with the problematic code
Lupus590 #5
Posted 12 May 2019 - 01:31 PM
Line 15 in the pastebin has a ] instead of ) on the end
Hydrotronics #6
Posted 12 May 2019 - 02:04 PM
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