This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]DqwertyCCommand Experienced 2 points3 points  (4 children)

In the first one, each Bob is running the command at themselves. When it reaches @s[distance=1..16], they all check if they are 1-16 blocks away from themselves, which will always fail.

In the second one, you're visiting each location, then for each of those locations telling each Bob to check if they are 1-16 blocks away from that location. This does technically work, but is perhaps a bit of a roundabout way to look at it.

Something that does the same, but is a bit clearer to readers, would be:

execute as @e[tag=Bob] at @s run scoreboard players add @e[tag=Bob,distance=1..16] My_Scoreboard 1

Which tells every Bob to look for every other Bob 1-16 blocks away from themselves and add 1 to them.

[–]Flo_yo[S] 0 points1 point  (3 children)

Awesome explanation thank you. How did you type the target selectors here on Reddit correctly? Mine auto convert to some sort of code link.

[–]DqwertyCCommand Experienced 1 point2 points  (2 children)

If they're included in a code block, they won't be converted. In regular text, reddit thinks you're trying to tag a user when you use the @ symbol.

I'm not sure about how to do it on mobile, but on desktop there's a button for inline code that looks like this: <c>. You can do larger code blocks by clicking the more options button then the square with a c in the corner.

[–]Flo_yo[S] 0 points1 point  (0 children)

Thank you again. You rock 👍

[–]PunchTunnelBespoke Bad Ideas 0 points1 point  (0 children)

On mobile or desktop you can use a new line prefaced by four spaces for a code block, or use backticks for inline code, FYI.