Solved How to replace a location with an integer

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!


    You can always check out skUnity Downloads for downloads and any other information about Skript!

Not open for further replies.


Feb 20, 2021
I am wondering if there is a syntax that can be changed more simply than the syntax below, and if it exist, I would like to know what syntax can be used as well.

set {test.%player%} to location(player's x-coordinate,130,player's z-coordinate)
.(another syntax)
set {test.%player%} to  "%{test.%player%}%"
replace "x: " with "" in {test.%player%}
replace "y: " with "" in {test.%player%}
replace "z: " with "" in {test.%player%}
replace "," with "" in {test.%player%}
I have several questions but I will limit myself to answer your question first. One way to do this and the shortest one might be just replacing all of that in one line:
# always use the list separator (::) for variables with expressions in the name, also use player's uuid if you want to keep this information over name changes.
set {test::%player's uuid%} to location(player's x-pos, 130, player's z-pos)

set {_loc} to "%{test::%player's uuid%}%"
replace all "x: ", ", y: ", ", z: " with "" in {_loc}
You could also get the x and z coords indenpendently:

# we can get the y as well but since it is a constant I figured that'd be unnecessary
set {_loc} to "%{test::%player%}'s x-pos% 130 %{test::%player%}'s z-pos%"

In any case, why are you doing this?
  • Like
Reactions: Scan
"In any case, why are you doing this?"

I'v wanted to use original minecraft commands in skript such as "/fill".
However when I insert just a location value in command, it couldn't recognize location. So I have to change the location value.

Thanks to your reply, I've found that It can replace several parts at once.

thanks a lot :emoji_slight_smile:
(I'm not good at English, so even if the grammar or word I wrote is awkward, I would appreciate it if you understand.)
Not open for further replies.