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 recognize wanted criminals in Godlike Burger? How can I recognize wanted criminals in Godlike Burger?

Posted On: October 17, 2023
There's this event in Godlike Burger where your restaurant may sometimes be visited by wanted criminals that you can kill for a money reward. Problem is, I don't see any distinguishable marks ...[More]


Is Hogwarts Legacy worth buying? Is Hogwarts Legacy worth buying?

Posted On: March 15, 2023
I’m not a big gamer, but I consider myself a big Harry Potter fan. The thing is, I’m very confused about this game. It looks amazing, but I’m afraid that I’ll be spending my mo...[More]


What does the padlock icon in Pokemon summary page mean? What does the padlock icon in Pokemon summary page mean?

Posted On: April 6, 2023
I've noticed that there's a padlock icon in every Pokemon summary page, but I can't figure out its meaning or how to use it. How can you lock a Pokemon? And lock from what? Or is tha...[More]


Luigis Mansion 3: Does a higher rank change the ending in any way? Luigis Mansion 3: Does a higher rank change the ending in any way?

Posted On: January 13, 2024
I've recently played through Luigi's Mansion 3. I didn't really care for any Boos, crystals or money, and the game awarded me with the rank B at the end of the credits scene.  Give...[More]


What are the rules for mega evolutions in Pokemon go? What are the rules for mega evolutions in Pokemon go?

Posted On: January 15, 2023
The rules for Pokémon go's mega evolutions have changed over time. There doesn't seem to be any one place in the publisher, Niantic, states all the rules, mechanics and benefits for meg...[More]


My Arabella cosplay My Arabella cosplay

Posted On: July 24, 2024
Question from user FridaAih at BaldursGate3 at reddit.com.Answer:Don’t go stealing any idols, or your mom will feed you to a gnoll.Answer from user Tavminater at BaldursGate3 at reddit.com....[More]


The real reason we don't have Quidditch in Hogwarts Legacy The real reason we don't have Quidditch in Hogwarts Legacy

Posted On: April 18, 2023
Question from user erwin4200 at HogwartsLegacyGaming at reddit.com. Answer: Why adding it to the game as DLC if you can squeeze out money with a separate full triple a release. Answer from us...[More]


How Did My Terraria Silver Pickaxe Got Damaged? How Did My Terraria Silver Pickaxe Got Damaged?

Posted On: May 12, 2023
I crafted my first silver pickaxe in Terraria 1.1. I did not examine its stats until some time later. The name color is grey with -14% damage. I have no problem mining with it but killing monsters ...[More]


What happens if you break the Old Barbarian Statue in Clash of Clans? What happens if you break the Old Barbarian Statue in Clash of Clans?

Posted On: July 11, 2023
As the title asks, what happens if you break (the original) Old Barbarian Statue in the builders base? I have looked online but there isn't much continuity in what it does. Some sources say you ge...[More]


Is there a way to turn off or not use auto battle? Is there a way to turn off or not use auto battle?

Posted On: April 29, 2024
So I like the idea of Pokemon following along outside their pokeball like in previous games, but I prefer to raise their experience manually myself. So my question is: is there a way to prevent Pokemo...[More]