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]

Tactical stance in COD MW3 - is there RL equivalent? Tactical stance in COD MW3 - is there RL equivalent?

Posted On: January 19, 2024
The new tactical stance in COD MW3 - is it based on reality? I can't imagine why holding a weapon tilted would give you an advantage in combat. Any insight? Question from user Boppity Bop at st...[More]


Why does no one use controllers? Why does no one use controllers?

Posted On: May 14, 2024
Seriously, every video I see online is someone playing the game while have to click every time they want to move and they have a huge action bar at the bottom of the screen. Why don’t more people us...[More]


Infuriating plot point Infuriating plot point

Posted On: October 2, 2023
Is anyone else infuriated by the way the tadpoles are handled? We're told from the outset that these things are bad, like as bad as you can get. Literally no reason you would want them at all, but...[More]


What is Monster Hunter Language in the voice language selector? What is Monster Hunter Language in the voice language selector?

Posted On: March 10, 2023
I started the game for the first time and I saw an option called "Monster Hunter Language" on the Voice Language Settings. What is it? Question from user Lemon at gaming.stackexchange.com...[More]


Minecraft Powering a redstone torch on a block adjacent to a redstone lamp without powering the lamp Minecraft Powering a redstone torch on a block adjacent to a redstone lamp without powering the lamp

Posted On: April 1, 2023
Would it be possible to power the redstone torch in this configuration without powering the redstone lamp? Question from user Looky1173 at gaming.stackexchange.com. Answer: I assume by "...[More]


Why dont I have permission to use WorldEdit? Why dont I have permission to use WorldEdit?

Posted On: February 13, 2023
I'm trying to install WorldEdit, and I've done the following:. Gotten the craftbukkit JAR, run it, stopped it, replaced world with my save from single, run again, stopped again, ...[More]


Is Bae'zel Green or Yellow? Is Bae'zel Green or Yellow?

Posted On: February 5, 2025
Question from user DearPersimmon8155 at BaldursGate3 at reddit.com.Answer:Yes.Answer from user Toki_mon at BaldursGate3 at reddit.com....[More]


Frequency of the Golden Bowser Train? Frequency of the Golden Bowser Train?

Posted On: January 28, 2023
Does anyone happen to know how often you can go to the Golden Bowser Train? For those that don't yet know, it is a level with nothing but coins, and is a great way to bolster your extra lives.Questio...[More]


Wait, Spell Scribing from Wizard dips is bad, isn't it? Wait, Spell Scribing from Wizard dips is bad, isn't it?

Posted On: May 5, 2025
Okay, so I know a lot of people, when making a pure spell caster, like to take a single level dip into Wizard, since, at Level 12, you'll be able to learn up to Level 6 spells from scrolls. But isn't ...[More]


How to set Steam to always choose the same launch option for a game? How to set Steam to always choose the same launch option for a game?

Posted On: February 5, 2023
Sometimes when you launch a game you have to choose between different launch options:.Is it possible to configure Steam so the startup window is skipped and a specific options is chosen?I my case I wa...[More]