Code:
function direction(from: location, to: location) :: text:
set pitch of {_from} to 0.001
set {_behind} to true if (flatDistance({_from}, {_to})) - flatDistance(location 1 meter behind {_from} and {_to}) > 1/3
set {_infrontof} to true if (flatDistance({_from}, {_to})) - flatDistance(location 1 meter in front of {_from} and {_to}) > 1/3
set {_right} to true if (flatDistance({_from}, {_to})) - flatDistance(location 1 meter right {_from} and {_to}) > 1/3
set {_left} to true if (flatDistance({_from}, {_to})) - flatDistance(location 1 meter left {_from} and {_to}) > 1/3
return "⬊" if {_behind} and {_right} are true
return "⬋" if {_behind} and {_left} are true
return "⬈" if {_infrontof} and {_right} are true
return "⬉" if {_infrontof} and {_left} are true
if {_right} and {_left} are not set:
return "⬆" if {_infrontof} is true
return "⬇" if {_behind} is true
if {_infrontof} and {_behind} are not set:
return "<-" if {_left} is true
return "->" if {_right} is true
return "✔"
function flatDistance(from: location, to: location) :: number:
set y coordinate of {_from} to y coordinate of {_to}
return distance between {_from} and {_to}
every tick:
set {_location} to location(0, 0, 0, world "sehir")
loop all players in world "world":
set {_direction} to direction(location of loop-player and {_location})
set {_distance} to round(flatDistance(loop-player and {_location}))
send action bar "&a%{_direction}%&r %{_distance}% blok uzaklıkta" to loop-player