Created
June 2, 2012 18:09
-
-
Save opamp/2859403 to your computer and use it in GitHub Desktop.
Transform coordinates for Minecraft.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- tc.lua 2012-06-03 12:32:38.000000000 +0900 | |
+++ tc.en.lua 2012-06-03 12:36:24.000000000 +0900 | |
@@ -29,20 +29,20 @@ | |
function getCoordinates() | |
repeat | |
tmp = {} | |
- print("x座標") | |
+ print("x-coordinate") | |
tmp["x"] = tonumber(io.read()) | |
- print("y座標") | |
+ print("y-coordinate") | |
tmp["y"] = tonumber(io.read()) | |
- print("z座標") | |
+ print("z-coordinate") | |
tmp["z"] = tonumber(io.read()) | |
until checkCoordinates(tmp["x"],tmp["y"],tmp["z"]) == true --入力された値が正しくなるまでループ | |
return tmp["x"],tmp["y"],tmp["z"] | |
end | |
-print("知りたい座標はどちらですか?") | |
-print("1.目的地のネザー座標 (目的地の現実座標を入力する必要があります)") | |
-print("2.目的地の現実座標 (目的地のネザー座標を入力する必要があります)") | |
+print("Which coordinates do you want to know?") | |
+print("1.Nether World Coordnates") | |
+print("2.Real World Coordinates") | |
t = 0 | |
repeat | |
@@ -52,14 +52,14 @@ | |
n_m = {} --目的地の座標を入力する | |
result = {} -- 計算結果の座標 | |
if t == 1 then | |
- print("目的地の現実座標を入力してください") | |
+ print("Please input real world coordinates.") | |
n_m["x"],n_m["y"],n_m["z"] = getCoordinates() | |
result["x"] = n_m["x"] / 8 | |
result["y"] = n_m["y"] | |
result["z"] = n_m["z"] / 8 | |
else | |
- print("目的地のネザー座標を入力してください") | |
+ print("Please input nether world coordinates.") | |
n_m["x"],n_m["y"],n_m["z"] = getCoordinates() | |
result["x"] = n_m["x"] * 8 | |
@@ -67,13 +67,12 @@ | |
result["z"] = n_m["z"] * 8 | |
end | |
-print("結果") | |
+print("--RESULT--") | |
if t == 1 then | |
- print("あなたの目的地の現実座標 ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
- print("あなたの目的地のネザー座標 ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
+ print("Real world coordinates ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
+ print("Nether world coordiantes ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
else | |
- print("あなたの目的地のネザー座標 ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
- print("あなたの目的地の現実座標 ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
+ print("Nether world coordinates ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
+ print("Real world coordinates ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
end | |
-print("終了します") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
現実の座標とネザーの座標から対応した座標を計算する。 | |
ComputerCraftで導入されるコンピューター上で動作させることを考えて作っていますが、このスクリプトはUNIXターミナル上でしかテストされていません。 | |
実際のComputerCraftでの動作確認はまだです。 | |
英語化ptach作りました。似非英語ですが... | |
**わかってるバグ(Evident bugs)** | |
文字列が数字かどうかを判定する処理に問題があるため、数字以外の文字を代入すると強制終了します。 | |
]]-- | |
function isThisNumber(x) | |
if type(x) == "number" then | |
return true | |
else | |
return false | |
end | |
end | |
function checkCoordinates(x,y,z) | |
if isThisNumber(x) == true and isThisNumber(y) == true and isThisNumber(z) == true then | |
return true | |
else | |
return false | |
end | |
end | |
function getCoordinates() | |
repeat | |
tmp = {} | |
print("x座標") | |
tmp["x"] = tonumber(io.read()) | |
print("y座標") | |
tmp["y"] = tonumber(io.read()) | |
print("z座標") | |
tmp["z"] = tonumber(io.read()) | |
until checkCoordinates(tmp["x"],tmp["y"],tmp["z"]) == true --入力された値が正しくなるまでループ | |
return tmp["x"],tmp["y"],tmp["z"] | |
end | |
print("知りたい座標はどちらですか?") | |
print("1.目的地のネザー座標 (目的地の現実座標を入力する必要があります)") | |
print("2.目的地の現実座標 (目的地のネザー座標を入力する必要があります)") | |
t = 0 | |
repeat | |
t = tonumber(io.read()) | |
until t == 1 or t == 2 | |
n_m = {} --目的地の座標を入力する | |
result = {} -- 計算結果の座標 | |
if t == 1 then | |
print("目的地の現実座標を入力してください") | |
n_m["x"],n_m["y"],n_m["z"] = getCoordinates() | |
result["x"] = n_m["x"] / 8 | |
result["y"] = n_m["y"] | |
result["z"] = n_m["z"] / 8 | |
else | |
print("目的地のネザー座標を入力してください") | |
n_m["x"],n_m["y"],n_m["z"] = getCoordinates() | |
result["x"] = n_m["x"] * 8 | |
result["y"] = n_m["y"] | |
result["z"] = n_m["z"] * 8 | |
end | |
print("結果") | |
if t == 1 then | |
print("あなたの目的地の現実座標 ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
print("あなたの目的地のネザー座標 ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
else | |
print("あなたの目的地のネザー座標 ("..n_m["x"]..","..n_m["y"]..","..n_m["z"].. ")") | |
print("あなたの目的地の現実座標 ("..result["x"]..","..result["y"]..","..result["z"].. ")") | |
end | |
print("終了します") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment