Post the rest of the code.
---------------------------------------------------
-- Made By: MrProgrammer
--
-- Website: www.programmersparadise.moonfriut.com
--
-- All code is copyrighted, Charlie Kendall 2015©
--
version = "v1.2.1"
---------------------------------------------------
local colourTbl = {c_header = 16, c_error = 128, c_border = 512}
--c_border = 512
--c_header = 16
c_writing = 1
c_off = 16384
c_on = 32
compDSP = 4
c_menu = 258
--c_error = 128
black = 32768
remoteConnectOption = nil
compName = "Quarantine_Farming ".. version
---------------------------------------------------
function tBar()
term.clear()
term.setCursorPos(1,1)
term.setTextColour(colourTbl["c_header"])
term.setBackgroundColour(colourTbl["c_error"])
term.clearLine()
term.setCursorPos(1,1)
print(compName)
term.setTextColour(c_off)
term.setCursorPos(31,1)
print("System ^^")
term.setBackgroundColour(black)
end
function mainScreen()
end
function drawSubMenu()
term.setBackgroundColour(c_writing)
term.setTextColour(c_menu)
term.setCursorPos(21,2)
print("===================")
term.setTextColour(colourTbl["c_border"])
term.setCursorPos(21,3)
print(" Reboot System ")
term.setCursorPos(21,4)
print(" ")
term.setCursorPos(21,5)
print(" Shutdown System ")
term.setCursorPos(21,6)
term.setTextColour(c_menu)
print("===================")
term.setCursorPos(31,1)
term.setTextColour(c_off)
term.setBackgroundColour(colourTbl["c_error"])
print("System <<")
term.setBackgroundColour(black)
end
function configCheck()
configFileDir = fs.exists("Farm_Cfg/WirelessControl")
if configFileDir ~= true then
fs.makeDir("Farm_Cfg/WirelessControl")
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,3)
term.clearLine()
term.setCursorPos(1,2)
print("Are you using the Wireless Addon?")
term.setCursorPos(1,3)
print("true or false:")
term.setCursorPos(15,3)
local userInput = read()
if userInput == "true" then
insertCfg = fs.open("Farm_Cfg/WirelessControl/config", "w")
insertCfg.writeLine("true")
insertCfg.close()
configCheck()
elseif userInput == "false" then
insertCfg = fs.open("Farm_Cfg/WirelessControl/config", "w")
insertCfg.writeLine("false")
insertCfg.close()
configCheck()
else
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,3)
term.clearLine()
term.setCursorPos(1,2)
print("Incorrect Statmet, True Or False, Try Again!")
fs.delete("Farm_Cfg")
configCheck()
end
end
readWireless = fs.open("Farm_Cfg/WirelessControl/config", "r")
checkWirelessCfg = readWireless.readLine()
readWireless.close()
if checkWirelessCfg == "true" then
remoteConnect()
remoteConnectOption = true
elseif checkWirelessCfg == "false" then
getFuel()
remoteConnectOption = false
end
end
function remoteConnect()
rednet.open("right")
CMD = rednet.receive()
if CMD == "RUN-x28" then
else
end
end
function getFuel()
fuel = turtle.getFuelLevel()
if fuel > 600 then
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,3)
term.clearLine()
term.setCursorPos(1,2)
print("Fuel Level: "..fuel)
pos()
else
turtle.select(16)
turtle.refuel(2)
turtle.select(1)
getFuel()
end
end
function rowX28()
for i=1,27 do
if turtle.detectDown() then
local suc, item = turtle.inspectDown()
if suc and item.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
else
turtle.down()
local farmland, block = turtle.inspectDown()
if farmland and block.name == "minecraft:farmland" then
turtle.up()
turtle.placeDown()
turtle.forward()
elseif farmland and block.name == "minecraft:grass" or "minecraft:dirt" then
turtle.up()
turtle.select(15)
turtle.equipLeft()
turtle.digDown()
turtle.equipLeft()
turtle.select(1)
turtle.placeDown()
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
else
turtle.down()
local farmland, block = turtle.inspectDown()
if farmland and block.name == "minecraft:farmland" then
turtle.up()
turtle.placeDown()
elseif farmland and block.name == "minecraft:grass" or "minecraft:dirt" then
turtle.up()
turtle.select(15)
turtle.equipLeft()
turtle.digDown()
turtle.equipLeft()
turtle.select(1)
turtle.placeDown()
end
end
end
function rowX28MOD()
for i=1,2 do
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
end
turtle.forward()
turtle.forward()
for i=1,5 do
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
end
turtle.forward()
turtle.forward()
for i=1,5 do
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
end
turtle.forward()
turtle.forward()
for i=1,5 do
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
end
turtle.forward()
turtle.forward()
for i=1,2 do
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
turtle.forward()
else
turtle.forward()
end
end
end
if turtle.detectDown() then
local suc, t = turtle.inspectDown()
if suc and t.metadata == 7 then
turtle.digDown()
turtle.placeDown()
end
end
end
function pos()
turtle.up()
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.forward()
farm()
end
function endPos()
turtle.turnRight()
for i=1,17 do
turtle.forward()
end
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.down()
turtle.dropDown(64)
turtle.select(2)
turtle.dropDown(64)
turtle.select(3)
turtle.dropDown(64)
turtle.select(4)
turtle.dropDown(64)
turtle.select(5)
turtle.dropDown(64)
turtle.select(6)
turtle.dropDown(64)
turtle.select(7)
turtle.dropDown(64)
turtle.select(8)
turtle.dropDown(64)
turtle.select(9)
turtle.dropDown(64)
turtle.select(10)
turtle.dropDown(64)
turtle.select(11)
turtle.dropDown(64)
turtle.select(12)
turtle.dropDown(64)
turtle.select(13)
turtle.dropDown(64)
turtle.select(14)
turtle.dropDown(64)
turtle.select(1)
sleep(300)
os.reboot()
end
function farm()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28MOD()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28MOD()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
rowX28()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
rowX28()
endPos()
end
tBar()
drawSubMenu()
there is nothing else in the code that is making this error, ive checked everything, like i say the whole program works fine untill i remove the comments from that one function, this is the program I'm working on at the minute, won't bother posting my 2000+ code becouse whatever is wrong with this one will be the same as the other program.