1

Operation on store result?

codefox_ 5/14/22 2:10 pm
181
5/14/2022 8:00 pm
So I'm trying to store a players coordinates in 3 scoreboards, if I just use these commands
execute store result score @a[scores={deathCountTP=1}] deathX run data get entity @s Pos[0]
execute store result score @a[scores={deathCountTP=1}] deathY run data get entity @s Pos[1]
execute store result score @a[scores={deathCountTP=1}] deathZ run data get entity @s Pos[2]

I lose the decimals, since scoreboards can't store those. The solution for this would be to multiply the scores by, let's say 1000 to keep 3 decimals, then divide them again by 1000 when I need to use them.
So, my question is - how do I do this? I'm very new to operations and store, so I have no idea how to multiply the coordinates before putting them in the scoreboard, nor do I know how to use them to teleport a player (and divide them by 1000 before doing that)
Posted by
codefox_
Level 38 : Artisan Fox
7

  Have something to say?

JoinSign in

3

codefox_
05/14/2022 2:38 pm
Level 38 : Artisan Fox
Well I figured how to do the multiplying, just have to do
execute store result score @a[scores={deathCountTP=1}] deathX run data get entity @s Pos[0] 1000
execute store result score @a[scores={deathCountTP=1}] deathY run data get entity @s Pos[1] 1000
execute store result score @a[scores={deathCountTP=1}] deathZ run data get entity @s Pos[2] 1000

The only thing missing now is dividing it and teleporting a player there (..if that's even possible :p)
1
codefox_
05/14/2022 2:52 pm
Level 38 : Artisan Fox
Now, for the dividing I can do something like
/execute store result ??? run scoreboard players operation ShiruTheFox deathX /= #1000 constant
This only works once, since it also devides the actual score in my scoreboard, but in my case that luckily isn't a problem (though I'm sure there's a workaround, using another scoreboard)
What now remains is the hardest question - how the hell do I get these 3 numbers into a teleport command, if I can even do that
1
codefox_
05/14/2022 8:00 pm
Level 38 : Artisan Fox
I eventually found a workaround by using an area effect cloud, setting the position of that effect cloud to the scoreboard coordinates, then teleporting the player to the effect cloud (meaning the chunk has to be forceloaded :P)



(if anyone reading this wants to know the exact fix lmk)
1

Welcome