Posted 22 November 2012 - 03:19 PM
Hello, I am relatively new to ComputerCraft, and I wrote a program to run a frames quarry and received the above error.
Here is my code:
After I select the depth I want, I get the above error message. It only started after I updated to ComputerCraft 1.4. Also, before updating, I couldn't get the cancellation part of askDepth() to work. Can anyone see the problem? Thanks in advance!
Here is my code:
function askDepth()
write("How deep? --> ")
local x=read()
term.clear()
term.setCursorPos(1,1)
if x==0 then
local ans=""
print("Do you want to cancel excavation? yes/no")
ans=read()
if ans=="yes" then
shell.exit()
else if ans=="no" then
print("Exiting program...")
sleep(1.5)
shell.exit()
else
print("Answer not recognized, exiting program...")
sleep(1.5)
shell.exit()
end
end
end
function breakBlocks()
rs.setOutput('top', true)
print("Excavating...")
sleep(0.4)
rs.setOutput('top', false)
end
function moveNorth()
rs.setOutput('back', true)
print("Moving North...")
sleep(1.6 )
rs.setOutput('back', false)
end
function moveDown()
rs.setOutput('right', true)
print("Moving Down...")
sleep(1.6)
rs.setOutput('right', false)
end
function moveSouth()
rs.setOutput('left', true)
print("Moving South")
sleep(1.6)
rs.setOutput('left', false)
end
function excavate()
moveNorth()
breakBlocks()
moveSouth()
breakBlocks()
moveDown()
term.clear()
term.setCursorPos(1,1)
end
write("Note: Until the PhilQuarry program is")
write(" updated, it excavates only a 6x8 area,")
print(" and only moves south and north.")
print("")
--write("How deep?: ")
--local x=read()
--term.clear()
--term.setCursorPos(1,1)
askDepth()
write("0/")
write(x)
print(" Layer(s) Excavated")
for i=1, x do
excavate()
write(i)
write("/")
write(x)
print(" Layer(s) Excavated")
end
term.clear()
term.setCursorPos(1,1)
write(x)
write("/")
write(x)
print(" Layers Excavated")
sleep(1.5)
print("Excavation Complete")
After I select the depth I want, I get the above error message. It only started after I updated to ComputerCraft 1.4. Also, before updating, I couldn't get the cancellation part of askDepth() to work. Can anyone see the problem? Thanks in advance!