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]

How can I see which character has finished a certain level? How can I see which character has finished a certain level?

Posted On: December 19, 2023
I've played most of the levels in Super Mario 3D World with Princess Peach and after I've got Rosalina, then with her. If I want to reach the golden stars for the levels, I have to play each l...[More]


What does it mean when Im cowering in fear? What does it mean when Im cowering in fear?

Posted On: November 27, 2023
In the Kero Sewers, enemy Boos sometimes use a Scream attack that makes one of my party members cower in fear with a purple aura around them. The scared party member can seemingly still fight like nor...[More]


What is a spike in Tetr IO? What is a spike in Tetr IO?

Posted On: June 14, 2023
I play Tetr.io a lot. If I send a large amount of garbage, it shows a number, followed by “spike”. What is a spike?. I have found nothing, here on the Arqade, or on Google; just v...[More]


What does saying X mean in the faction chat in Albion Online? What does saying X mean in the faction chat in Albion Online?

Posted On: May 16, 2023
I see many people "x" in the chat, but I cannot find a clear answer to what it means. Asking in the chat also does not give me any answers. Question from user TheBird956 at gaming.stackex...[More]


Does harming a companion indirectly with Warding Bond affect their approval? Does harming a companion indirectly with Warding Bond affect their approval?

Posted On: March 14, 2024
If one of my companions casts.Warding Bond.on my main character, and therefore takes damage whenever "I" do, does.harming them in that way cause their approval to decrease?I would think not, since the...[More]


How can you run Skyrim in borderless window mode? How can you run Skyrim in borderless window mode?

Posted On: April 6, 2023
I've noticed Skyrim has some issues when minimizing. This is a real pain when playing on multiple monitors and you attempt to find something on the other monitor. Is there anyway to enable borderl...[More]


In A Dark Room, Is there a a reputation system for me among villagers? In A Dark Room, Is there a a reputation system for me among villagers?

Posted On: May 19, 2023
I was wondering if there was a reputation system that makes my villagers love/hate me with things such as choosing whether or not to hang the thief, cure plagues, give to beggars, etc. impacting it. ...[More]


Which BG3 NPCs would you like to fight in D&D? Which BG3 NPCs would you like to fight in D&D?

Posted On: November 20, 2023
I am currently organizing a D&D one shot/minigame for a large group, which consists of fighting a gauntlet of important characters from media, including games, movies and stuff even outside of D&a...[More]


What order are Pikmin retrieved from an Onion? What order are Pikmin retrieved from an Onion?

Posted On: March 31, 2024
When I retrieve Pikmin from an Onion at the start of a day, I noticed that the Pikmin will often be at different stages of maturity. Some will have flowers, while others will still be leaves. This mak...[More]


If I leave a Minecraft Realm will my signs disappear or still be there? If I leave a Minecraft Realm will my signs disappear or still be there?

Posted On: April 12, 2023
I wrote some notes on sign, if I leave that Minecraft Realm will my signs disappear or still be there? Question from user pickle at gaming.stackexchange.com. Answer: If this one below is the ...[More]