I remember seeing a skript which once utilized adding 2 variables responsible for location into 1 variable. I was wondering how that could be done?
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 community!
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!
I am not sure what a list variable is, all I am sure of is that I grabbed x, y and z and then combined them into 1 variable. Only reason I want to use this instead of grabbing their locations is because I don't want to use yaw and pitch.Might you be referring to a list variable? like {locations::*} potentially adding the value of other variables to that? A bit more context would be helpful if that's not the case![]()
Okay so maybe like this then?I am not sure what a list variable is, all I am sure of is that I grabbed x, y and z and then combined them into 1 variable. Only reason I want to use this instead of grabbing their locations is because I don't want to use yaw and pitch.
set {_x} to player's x-coordinate
set {_y} to player's y-coordinate
set {_z} to player's z-coordinate
# then when wanting to reference this coords as a location do so by making the new variable
set {_location} to "%{_x}% %{_y}% %{_z}%"
# so now the variable {_location} is equal to X Y Z. You could also set it to "%{_x}%, %{_y}%, %{_z}%"
# if you need commas for the location format
Yes, but it does not seem to work for me. The variable seems to be fine but it does not teleport me.Okay so maybe like this then?
[doublepost=1501611427,1501611313][/doublepost]Oh also, just for information purposes, a list variable contains more than one value. You can add numbers, text etc to it and then loop the list to get all or select values out of it. Very useful, there's a great tutorial on it in the tutorial section.code_language.skript:set {_x} to player's x-coordinate set {_y} to player's y-coordinate set {_z} to player's z-coordinate # then when wanting to reference this coords as a location do so by making the new variable set {_location} to "%{_x}% %{_y}% %{_z}%" # so now the variable {_location} is equal to X Y Z. You could also set it to "%{_x}%, %{_y}%, %{_z}%" # if you need commas for the location format
Can you post your code?Yes, but it does not seem to work for me. The variable seems to be fine but it does not teleport me.
Can you post your code?
command /ssm [<player>]:
permission: ss.m
permission message: &cYou do not have access to this command!
executable by: console
trigger:
if arg 1 is not set:
stop trigger
if arg 1 is set:
if {%arg-1%.ss} is true:
set {%arg-1%.ss} to false
delete {_ss.coords.%arg-1%}
wait 5 ticks
execute command "/mv tp %arg-1% spawn"
set the arg-1's walk speed to 0.2
stop trigger
if {%arg-1%.ss} is not set:
stop trigger
if {%arg-1%.ss} is false:
set {%arg-1%.ss} to true
if arg-1 is in "ProPracticeArenas":
execute command "/cancel %arg-1% A player in your match has been frozen"
execute command "/mv tp %arg-1% freeze"
wait 10 ticks
set the arg-1's walk speed to 0
set {_ss.coords.x.%arg-1%} to x coordinate of arg-1
set {_ss.coords.y.%arg-1%} to y coordinate of arg-1
set {_ss.coords.z.%arg-1%} to z coordinate of arg-1
set {_ss.coords.%arg-1%} to "%{_ss.coords.x.%arg-1%}% %{_ss.coords.y.%arg-1%}% %{_ss.coords.z.%arg-1%}%"
while {%arg-1%.ss} is true:
set {_ss.coordscheck.x.%arg-1%} to x coordinate of arg-1
set {_ss.coordscheck.y.%arg-1%} to y coordinate of arg-1
set {_ss.coordscheck.z.%arg-1%} to z coordinate of arg-1
set {_ss.coordscheck.%arg-1%} to "%{_ss.coordscheck.x.%arg-1%}% %{_ss.coordscheck.y.%arg-1%}% %{_ss.coordscheck.z.%arg-1%}%"
if {_ss.coordscheck.%arg-1%} is not {_ss.coords.%arg-1%}:
teleport arg-1 to {_ss.coords.%arg-1%}
wait 20 ticks
if {_ss.coordscheck.%arg-1%} is {_ss.coords.%arg-1%}:
set {_ss.coordscheck.x.%arg-1%} to x coordinate of arg-1
set {_ss.coordscheck.y.%arg-1%} to y coordinate of arg-1
set {_ss.coordscheck.z.%arg-1%} to z coordinate of arg-1
set {_ss.coordscheck.%arg-1%} to "%{_ss.coordscheck.x.%arg-1%}% %{_ss.coordscheck.y.%arg-1%}% %{_ss.coordscheck.z.%arg-1%}%"
wait 20 ticks
else:
execute command "/mv tp %arg-1% freeze"
wait 10 ticks
set the arg-1's walk speed to 0
set {_ss.coords.x.%arg-1%} to x coordinate of arg-1
set {_ss.coords.y.%arg-1%} to y coordinate of arg-1
set {_ss.coords.z.%arg-1%} to z coordinate of arg-1
set {_ss.coords.%arg-1%} to "%{_ss.coords.x.%arg-1%}% %{_ss.coords.y.%arg-1%}% %{_ss.coords.z.%arg-1%}%"
while {%arg-1%.ss} is true:
set {_ss.coordscheck.x.%arg-1%} to x coordinate of arg-1
set {_ss.coordscheck.y.%arg-1%} to y coordinate of arg-1
set {_ss.coordscheck.z.%arg-1%} to z coordinate of arg-1
set {_ss.coordscheck.%arg-1%} to "%{_ss.coordscheck.x.%arg-1%}% %{_ss.coordscheck.y.%arg-1%}% %{_ss.coordscheck.z.%arg-1%}%"
if {_ss.coordscheck.%arg-1%} is not {_ss.coords.%arg-1%}:
teleport arg-1 to {_ss.coords.%arg-1%}
wait 20 ticks
if {_ss.coordscheck.%arg-1%} is {_ss.coords.%arg-1%}:
set {_ss.coordscheck.x.%arg-1%} to x coordinate of arg-1
set {_ss.coordscheck.y.%arg-1%} to y coordinate of arg-1
set {_ss.coordscheck.z.%arg-1%} to z coordinate of arg-1
set {_ss.coordscheck.%arg-1%} to "%{_ss.coordscheck.x.%arg-1%}% %{_ss.coordscheck.y.%arg-1%}% %{_ss.coordscheck.z.%arg-1%}%"
wait 20 ticks
on join:
set {%arg-1%.ss} to true
on quit:
wait 1 tick
if {%arg-1%.ss} is false:
execute command "/ban %player% Logged out whilst frozen"
clear {%arg-1%.ss}
delete {_ss.coords.%arg-1%}
set {_location} to "%{_x}% %{_y}% %{_z}%" parsed as location
I get the exception "Text cannot be parsed as a location". I will try your other suggestion.you probably just need to parse it as a location since rn its a textor if that doesnt work use the location at expression http://bensku.github.io/Skript/expressions.html#ExprLocationAtcode_language.skript:set {_location} to "%{_x}% %{_y}% %{_z}%" parsed as location
I did this but it returns "'the world "Freeze"' is not an item stack". Here's my codeuse the location at expression http://bensku.github.io/Skript/expressions.html#ExprLocationAt
command /ssm [<player>]:
permission: ss.m
permission message: &cYou do not have access to this command!
executable by: console
trigger:
if arg-1 is not set:
stop trigger
if arg-1 is set:
if {%arg-1%.ss} is true:
set {%arg-1%.ss} to false
delete {_ss.coords.%arg-1%}
wait 5 ticks
execute command "/mv tp %arg-1% spawn"
set the arg-1's walk speed to 0.2
stop trigger
if {%arg-1%.ss} is not set:
stop trigger
if {%arg-1%.ss} is false:
set {%arg-1%.ss} to true
if arg-1 is in "ProPracticeArenas":
execute command "/cancel %arg-1% A player in your match has been frozen"
execute command "/mv tp %arg-1% freeze"
wait 10 ticks
set the arg-1's walk speed to 0
set {_ss.coords.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
while {%arg-1%.ss} is true:
set {_ss.coordscheck.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
if {_ss.coordscheck.%arg-1%} is not {_ss.coords.%arg-1%}:
teleport arg-1 to {_ss.coords.%arg-1%}
wait 20 ticks
if {_ss.coordscheck.%arg-1%} is {_ss.coords.%arg-1%}:
set {_ss.coordscheck.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
wait 20 ticks
else:
execute command "/mv tp %arg-1% freeze"
wait 10 ticks
set the arg-1's walk speed to 0
set {_ss.coords.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
while {%arg-1%.ss} is true:
set {_ss.coordscheck.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
if {_ss.coordscheck.%arg-1%} is not {_ss.coords.%arg-1%}:
teleport arg-1 to {_ss.coords.%arg-1%}
wait 20 ticks
if {_ss.coordscheck.%arg-1%} is {_ss.coords.%arg-1%}:
set {_ss.coordscheck.%arg-1%} to arg-1's x-coordinate, arg-1's y-coordinate, arg-1's z-coordinate of the world Freeze
wait 20 ticks
on join:
set {%arg-1%.ss} to true
on quit:
wait 1 tick
if {%arg-1%.ss} is false:
execute command "/ban %player% Logged out whilst frozen"
clear {%arg-1%.ss}
delete {_ss.coords.%arg-1%}
Still does not work. I also can't set the yaw and pitch, either.put freeze in quotes
set {_location} to location at x-coords of player , y-coords of player, z-coords of player in world "world"
It does not work for me. It doesn't teleport me. Here is my code:@verycoolguy123 What @Wynnevir said is quite correct , but you can do it using just:
code_language.skript:set {_location} to location at x-coords of player , y-coords of player, z-coords of player in world "world"
set the arg-1's walk speed to 0
set {_ss.coords.%arg-1%} to location at x-coords of arg-1 , y-coords of arg-1, z-coords of arg-1 in world "Freeze"
while {%arg-1%.ss} is true:
set {_ss.coordscheck.%arg-1%} to location at x-coords of arg-1 , y-coords of arg-1, z-coords of arg-1 in world "Freeze"
if {_ss.coordscheck.%arg-1%} is not {_ss.coords.%arg-1%}:
teleport arg-1 to {_ss.coords.%arg-1%}
wait 20 ticks
if {_ss.coordscheck.%arg-1%} is {_ss.coords.%arg-1%}:
set {_ss.coordscheck.%arg-1%} to location at x-coords of arg-1 , y-coords of arg-1, z-coords of arg-1 in world "Freeze"
wait 20 ticks
set {_loc} to location of arg-1
while {%arg-1%.ss} is true:
set {_loc.check} to location of arg-1
if {_loc} isn't {_loc.check}:
#CODE
wait 5 ticks
The reason I'm not using location is because I don't want yaw and pitch.That's just an example.
code_language.skript:set {_loc} to location of arg-1 while {%arg-1%.ss} is true: set {_loc.check} to location of arg-1 if {_loc} isn't {_loc.check}: #CODE wait 5 ticks
set {_x} to x-coords of arg-1
set {_y} to y-coords of arg-1
set {_z} to z-coords of arg-1
while {%arg-1%.ss} is true:
set {_x.check} to x-coords of arg-1
set {_y.check} to y-coords of arg-1
set {_z.check} to z-coords of arg-1
if {_x} isn't {_x.check}:
set {_next} to true
if {_y} isn't {_y.check}:
set {_next} to true
if {_z} isn't {_z.check}:
set {_next} to true
if {_next} is true:
#CODE
wait 5 ticks
I did this and it does not workcode_language.skript:set {_x} to x-coords of arg-1 set {_y} to y-coords of arg-1 set {_z} to z-coords of arg-1 while {%arg-1%.ss} is true: set {_x.check} to x-coords of arg-1 set {_y.check} to y-coords of arg-1 set {_z.check} to z-coords of arg-1 if {_x} isn't {_x.check}: set {_next} to true if {_y} isn't {_y.check}: set {_next} to true if {_z} isn't {_z.check}: set {_next} to true if {_next} is true: #CODE wait 5 ticks
set {_ss.coords.x.%arg-1%} to x-coords of arg-1
set {_ss.coords.y.%arg-1%} to y-coords of arg-1
set {_ss.coords.z.%arg-1%} to z-coords of arg-1
set {_ss.coords.%arg-1%} to arg-1's location
while {%arg-1%.ss} is true:
set {_ss.coordscheck.x.%arg-1%} to x-coords of arg-1
set {_ss.coordscheck.y.%arg-1%} to y-coords of arg-1
set {_ss.coordscheck.z.%arg-1%} to z-coords of arg-1
if {_ss.coordscheck.x.%arg-1%} is not {_ss.coords.x.%arg-1%}:
set {_next} to true
if {_ss.coordscheck.y.%arg-1%} is not {_ss.coords.y.%arg-1%}:
set {_next} to true
if {_ss.coordscheck.z.%arg-1%} is not {_ss.coords.z.%arg-1%}:
set {_next} to true
if {_next} is true:
teleport arg-1 to {_ss.coords.%arg-1%}
Okay so maybe like this then?
[doublepost=1501611427,1501611313][/doublepost]Oh also, just for information purposes, a list variable contains more than one value. You can add numbers, text etc to it and then loop the list to get all or select values out of it. Very useful, there's a great tutorial on it in the tutorial section.code_language.skript:set {_x} to player's x-coordinate set {_y} to player's y-coordinate set {_z} to player's z-coordinate # then when wanting to reference this coords as a location do so by making the new variable set {_location} to "%{_x}% %{_y}% %{_z}%" # so now the variable {_location} is equal to X Y Z. You could also set it to "%{_x}%, %{_y}%, %{_z}%" # if you need commas for the location format
It can have more than one, but it can also only have one valuecode_language.skript:set {_x} to x-coords of arg-1 set {_y} to y-coords of arg-1 set {_z} to z-coords of arg-1 while {%arg-1%.ss} is true: set {_x.check} to x-coords of arg-1 set {_y.check} to y-coords of arg-1 set {_z.check} to z-coords of arg-1 if {_x} isn't {_x.check}: set {_next} to true if {_y} isn't {_y.check}: set {_next} to true if {_z} isn't {_z.check}: set {_next} to true if {_next} is true: #CODE wait 5 ticks