Posted 24 March 2015 - 05:57 AM
Hi Pros,
I am trying to write a program that will TP a player around a large area to "pre-grenerate" chunks. I have the main code complete and working but I'd like for the program to TP the player back to the original center location (the location of the computer). I have not been able to figure out the correct way to get commands.getBlockPosition() and commands.tp() to work together to TP the player back to the computer's location.
Main Code:
Code used in testing:
The terminal will print the computer's position but i do not get TP'd, it just returns to the command line. I've tried multiple differnt argument areangements, comma's between arguments, concatenation, and this bit of code from another thread that is said to work and TP the player 20 blocks above the computer:
The tp commands are working fine in the mainc code with absolute and relative values, but I seem to be missing something when using the variables.
I am trying to write a program that will TP a player around a large area to "pre-grenerate" chunks. I have the main code complete and working but I'd like for the program to TP the player back to the original center location (the location of the computer). I have not been able to figure out the correct way to get commands.getBlockPosition() and commands.tp() to work together to TP the player back to the computer's location.
Main Code:
x, y, z = commands.getBlockPosition()
function vertLoop()
for i = 1, 10, 1 do
commands.tp("@p ~ 255 ~200")
print(i)
sleep(20)
end
end
function nextColumn()
commands.tp("@p ~200 255 ~-2000")
sleep(20)
end
function chunkGen()
for x = 1, 9, 1 do
vertLoop()
nextColumn()
end
vertLoop()
end
--Main Code
commands.tp("@p ~-1000 255 ~-1000") --TP player to NW corner.
sleep(20)
chunkGen()
--Return to Computer's location. (NOT WORKING)
commands.tp("@p x y x")
Code used in testing:
x, y, z = commands.getBlockPosition()
print( "Command Computer's position:" )
print("X: ", x)
print("Y: ", y)
print("Z: ", z)
commands.tp("@p x y z")
The terminal will print the computer's position but i do not get TP'd, it just returns to the command line. I've tried multiple differnt argument areangements, comma's between arguments, concatenation, and this bit of code from another thread that is said to work and TP the player 20 blocks above the computer:
local x, y, z = commands.getBlockPosition()
commands.tp("@a[x="..x..",y="..(y+1)..",z="..z..",r=1] ~ ~20 ~")
The tp commands are working fine in the mainc code with absolute and relative values, but I seem to be missing something when using the variables.