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]

Why does the Pokémon count show one more than the actual Pokémon I have? Why does the Pokémon count show one more than the actual Pokémon I have?

Posted On: June 17, 2023
I have 11 Pokémon, none duplicate. But the count at the top shows 12. Is this a bug, or does it count the Pokémon in the egg, too? Question from user Shaunak D at stackexchange. ...[More]


How can I defeat guardians in Breath Of The Wild? How can I defeat guardians in Breath Of The Wild?

Posted On: August 9, 2023
I have not been able to discover a method of defeating guardians. I have to run away every time. What are some methods to defeating these giant instant death laser creatures? Question from user Gar...[More]


Cannot figure out why the door will not open in Hogwarts Legacy Cannot figure out why the door will not open in Hogwarts Legacy

Posted On: July 17, 2023
I used accio on the handle in the Ranrok evidence search and cannot figure out why the door will not open. I’m worried that I missed something, any suggestions? Question from user Apprehensiv...[More]


The Polyjuice Potion didn't wear off completely The Polyjuice Potion didn't wear off completely

Posted On: April 7, 2023
I'm in shock and awe. I actually had half a mind to play the rest of the game like this because what tf even. I guess what happened is that when the Polyjuice Potion wore off, it didn't remove...[More]


What does SP do? What does SP do?

Posted On: May 19, 2023
I recently decided to subscribe to Nintendo Switch Online, so I can play the NES games included in the service. When I launched the NES Nintendo Switch Online app, I noticed that some games were li...[More]


Do maps fill out while exploring underground? Do maps fill out while exploring underground?

Posted On: April 26, 2024
When a craftable map is held, exploring the world will fill out areas of the map with an image of the world surface. Will said map be updated the same way if held while exploring underground? Or will ...[More]


How to mark items as junk in The Outer Worlds? How to mark items as junk in The Outer Worlds?

Posted On: May 2, 2023
Items you've marked as Junk can be sold in bulk. Okay, so how do I mark items as junk? There is no UI in the game or anything else, just a tip that suggests that you can mark items as junk. ...[More]


Where to get Spring Heeled double-jump Trinket? Where to get Spring Heeled double-jump Trinket?

Posted On: July 19, 2023
I just beat the first mission Ubiquity (Wenjie) Visionary. For some reason, I sacrificed the Spring Heeled double-jump Trinket. Now I want to go on to the second mission Chaos Theory (Harriet) Visiona...[More]


Is there a way to easily spot unopened chests in Genshin Impact? Is there a way to easily spot unopened chests in Genshin Impact?

Posted On: February 20, 2023
I was looking at the Genshin Impact trophies I had left, and most of them are 'Open 100, 200, 300, 400 chests in the Area'. I did not note which chests I did or not open; so having a map th...[More]


How do you gain treasure from fishing? How do you gain treasure from fishing?

Posted On: March 14, 2024
I know that you can gain treasure from fishing, (Saddles, enchanted books, enchanted bows etc.) but what is the criteria for collecting treasure? Does fishing in a specific biome count? Also, what are...[More]