3

I have an arbitrary Command Block.

Using minecraftjson.com I set it up to /tellraw everyone: "[ the selector @p ] is a new player on the server. Greet them!".

/tellraw @a ["",{"selector":"@p","color":"green"},{"text":" is a new player on the server. Greet them!","color":"green"}]

When they read the text in the chat, what will they see? Will they read that they are a new player on the server (being them the player closest to themselves) or that the player closest to the Command Block is a new player on the server?

In other words, are selector locations and count in /tellraw commands relative to who reads or who executes?

  • 1
    Did you want to write /tellraw @a? – Fabian Röling Sep 6 '17 at 8:37
  • I'm pretty sure it's the executor, that means that if Horst executes the command (with @a at the beginning), then it will always say "Horst". But I have to check when I'm home, that's in ~9 hours. – Fabian Röling Sep 6 '17 at 8:38
  • 1
    @Fabian yes, I did – Manchineel Sep 6 '17 at 8:45
  • Actually, I just found it in the German wiki. Writing an answer... – Fabian Röling Sep 6 '17 at 8:58
  • 1
    Somewhat unrelated, but I always hate it when computer programs try to "encourage" social interaction by suggesting actions to take when something happens. If I want to greet someone, I will greet them, but I don't want to feel like I'm urged to be social just because I play a multiplayer game. A chat message like the one above can easily put me off the server. – Nzall Sep 6 '17 at 9:52
3

The selector of /tellraw is only the target for the message, it does not change the executor (like /execute does). So the selector is from the executor's point of view.

The last example here (archive) is pretty much exactly what you want and it says that all players will get the name of the player closest to the executor into chat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.