Posted 29 July 2017 - 03:43 PM
Hello!
I am creating a turtle bomber program. It listens for rednet messages and executes the bombing, but it doesn't move!
I think i wrote something wrong.
Here's the code:
Controller:
Turtle:
Thanks for replies :)/>
I am creating a turtle bomber program. It listens for rednet messages and executes the bombing, but it doesn't move!
I think i wrote something wrong.
Here's the code:
Controller:
function bomber()
print("How many blocks you want turtle to go up?")
local height = read()
rednet.broadcast(height)
term.clear()
term.setCursorPos(1, 1)
print("Height:")
print(height)
sleep(1)
term.clear()
term.setCursorPos(1, 1)
print("How many blocks you want turtle to go up?")
local lenght = read()
rednet.broadcast(lenght)
term.clear()
term.setCursorPos(1, 1)
print("Lenght:")
print(lenght)
print("Starting bomber attack!")
sleep(1)
local go = "go"
rednet.broadcast(go)
end
rednet.open("back")
bomber()
Turtle:
function bomber()
while true do
local height = rednet.receive()
local lenght = rednet.receive()
local bstart = rednet.receive()
if bstart == "go" then
print("Running bomber operation!")
for i=1, height do
turtle.up()
end
else
print("Error! Can't go up!")
end
for i=1, lenght do
redstone.setOutput("bottom", true)
turtle.forward()
turtle.forward()
turtle.placeDown()
redstone.setOutput("bottom", false)
end
end
end
bomber()
Thanks for replies :)/>