Command to say player coords in chat?

[BACK]
Command to say player coords in chat?
Posted On: January 28, 2023

Trying to get a command that tells a player's coords in chat. I have a working command: /data get entity @s Pos, but I assume I would need to combine this with /tellraw?


Question from user Aceplante at gaming.stackexchange.com.


Answer:

You can do that using just tellraw:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"nbt":"Pos[0]","entity":"@s"},{"text":" Y:"},{"nbt":"Pos[1]","entity":"@s"},{"text":" Z:"},{"nbt":"Pos[2]","entity":"@s"}].


That is going to display the coordinates but in the form of a decimal number with a lot of digits. If you want to display whole numbers, what you can do is store the values into scoreboard objectives (storing them converts them to integers) and then display the objectives using /tellraw.


This is how you store the coordinates into objectives:.


/execute store result score @s x run data get entity @s Pos[0].


/execute store result score @s y run data get entity @s Pos[1].


/execute store result score @s z run data get entity @s Pos[2].


And this is how you display the values:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"score":{"name":"@s","objective":"x"}},{"text":" Y:"},{"score":{"name":"@s","objective":"y"}},{"text":" Z:"},{"score":{"name":"@s","objective":"z"}}].


Answer from user MegaCrafter10 at gaming.stackexchange.com.


[BACK]
Command to say player coords in chat?
Posted On: January 28, 2023

Trying to get a command that tells a player's coords in chat. I have a working command: /data get entity @s Pos, but I assume I would need to combine this with /tellraw?


Question from user Aceplante at gaming.stackexchange.com.


Answer:

You can do that using just tellraw:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"nbt":"Pos[0]","entity":"@s"},{"text":" Y:"},{"nbt":"Pos[1]","entity":"@s"},{"text":" Z:"},{"nbt":"Pos[2]","entity":"@s"}].


That is going to display the coordinates but in the form of a decimal number with a lot of digits. If you want to display whole numbers, what you can do is store the values into scoreboard objectives (storing them converts them to integers) and then display the objectives using /tellraw.


This is how you store the coordinates into objectives:.


/execute store result score @s x run data get entity @s Pos[0].


/execute store result score @s y run data get entity @s Pos[1].


/execute store result score @s z run data get entity @s Pos[2].


And this is how you display the values:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"score":{"name":"@s","objective":"x"}},{"text":" Y:"},{"score":{"name":"@s","objective":"y"}},{"text":" Z:"},{"score":{"name":"@s","objective":"z"}}].


Answer from user MegaCrafter10 at gaming.stackexchange.com.


[BACK]

Who knows Dark Magic? Who knows Dark Magic?

Posted On: February 12, 2023
When playing Harry Potter Years 5 to 7, I noticed there are things only Wizards with Dark Magic can interact with. I figure these are things I will have to go back and do later, as right now I don'...[More]


How can I teleport to an unloaded entity in Minecraft? How can I teleport to an unloaded entity in Minecraft?

Posted On: June 21, 2023
I am using invisible invulnerable ArmorStands to create "warps" and "homes" in a map. The idea is that I can spawn them in with a specific name, and then teleport a player back to ...[More]


What happens to my boarding party if the enemy ship surrenders? What happens to my boarding party if the enemy ship surrenders?

Posted On: March 15, 2024
In Faster than Light, if I still have crew members on the enemy ship when they surrender: What happens to my boarding crew members if I accept the offer from the enemy ship?Question from user stack_ho...[More]


Is it dangerous to go extreme pig riding in a thunderstorm? Is it dangerous to go extreme pig riding in a thunderstorm?

Posted On: January 6, 2015
I like to saddle up my piggy for a ride into thunderstorms. But what happens to my piggy if we get hit by lightning? Question from user Sadly Not at gaming.stackexchange.com. Answer: If a pig...[More]


Hogwarts Legacy Beginner Tips Hogwarts Legacy Beginner Tips

Posted On: April 21, 2023
Hey! Orderd a ps5 yesterday with hogwarts legacy and it will arrive today. Are there any important things i should know about the game? (Without spoilers). And is the game long? Are the most glitch...[More]


What is the record word size for a gaming system? What is the record word size for a gaming system?

Posted On: February 20, 2023
I remember the "bit wars" of the late 1980s and early 1990s. The Genesis/Mega Drive and the PC Engine/Turbografx-16 were heavily marketed in the very early 90's as having twice as many &...[More]


Can anyone explain how time works in this game? Can anyone explain how time works in this game?

Posted On: November 16, 2023
So I had an issue early on that's kinda ruined my experience. When I found the gith woman locked in the cage, I talked the tieflings into moving, but then I couldn't figure out how to target t...[More]


Is BG3 worth it for someone who doesn't like the setting? Is BG3 worth it for someone who doesn't like the setting?

Posted On: December 15, 2025
Hi, I'm a long time D&D fan, although most of my experience comes from the older editions (B/X edition and AD&D 1e are my faves), not much 5e experience (tried to run 5e campaigns on two separate occa...[More]


How can I reach Whimsyshire, the secret level in Diablo III? How can I reach Whimsyshire, the secret level in Diablo III?

Posted On: April 24, 2014
There's information that there's a secret level in Diablo III, similar to Diablo II's "Secret Cow Level". How can I reach that secret area in Diablo III? Question from user...[More]


Where do I sell Specials? Achievement: Arent you Special in Farmville? Where do I sell Specials? Achievement: Arent you Special in Farmville?

Posted On: April 13, 2023
How can I sell the specials? I would like to get the Google Play achievement but my selling board does not have a "special". I am level 52. I understand I may be lacking some requireme...[More]