There are two things wrong with your command.
The target selector for the first execute is wrong, although I assume this to be a typo. It should (probably) be
@e[score_PigProgress_min=1,score_PigProgress=1]
although the second part is not really necessary, unless porkchops with a score of 2 are a different thing.
/execute
does not support matching dataTags, which is what you are attempting in the second execute. You will have to assign a scoreboard value for diamond items, similar to what you did with the porkchops.
Lastly, to achieve what you want, I suggest summoning an invisible Armor Stand to work using the double execute and work from there. I.e.
/execute @e[type=Item,score_PigProgress_min=1] ~ ~ ~ /execute @e[type=Item,score_isDiamond_min=1,r=1] ~ ~ ~ /summon ArmorStand ~ ~ ~ {CustomName:"Marker1",Marker:1b,Invisible:1,Invulnerable:1,NoGravity:1}
This assumes all pork chops and only those have a PigProgress score of 1 or more, and all Diamond Items (and only those) have a isDiamond
score of 1 or more.
Now you can execute everything else (/kill
ing the items, saying "Hi", etc.) from the armor stand using
/execute @e[type=ArmorStand,name=Marker1] ~ ~ ~ <command>
Don't forget to kill the armor stand in the end as well.
You need to add more escape characters to deeper-nested quotation marks. You open the Text1
tag with a "
, thus the very next "
character closes it. You open the value
tag for the click event with \"
, meaning the next \"
you use will close it, which occurs in your nested /give
command's NBT data (specifically just after the Name
tag). That it what's causing your issue.
The formula to determine the number of backslashes required is: 2n+1
, where n
is the number of current backslashes. For the nested NBT data, you need 3 backslashes per quotation mark (\\\"
).
Fixed command:
/give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"[Sell]\",\"color\":\"dark_purple\",\"bold\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"clear @p[name=rainbowlack,r=3] cactus 0 2304\"}}",Text2:"{\"text\":\"2304 Cacti\",\"color\":\"red\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"give @p[name=rainbowlack,r=3] minecraft:cookie 18 0 {display:{Name:\\\"$100 Cookie\\\",Lore:[$100]}}\"}}",Text3:"{\"text\":\"iIiIiIi\",\"color\":\"light_purple\",\"strikethrough\":true,\"obfuscated\":true}",Text4:"{\"text\":\"[Sell]\",\"color\":\"dark_purple\",\"bold\":true}"},display:{Name:"Custom Sign"}}
Best Answer
You need to specify the radius:
this will test if there is a
Pokeball
item within 5 blocks ofTestCatch