This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Aaronace30's profile picture

Stuck with code

Started by Aaronace30, 14 August 2013 - 01:12 PM
Aaronace30 #1
Posted 14 August 2013 - 03:12 PM
Title: Stuck with code

Hi I have recently written this code but when i went to use it it said there was an error does anyone know how I can fix it?
note: i have separated the line that the error code said had something wrong "if E key is pressed then"



print("Place saplings in slot 1, bonemeal in slot 2 and fuel in slot 3")




if E key is pressed then




print("Checking Fuel")
if turtle.getFuelLevel() == <100 then
turtle.refuel()
print("Refueling…")
else
print("Enough Fuel")
end
local function sapling()
turtle.select(1)
turtle.place()
sleep(.1)
end
local function bonemeal()
turtle.select(2)
turtle.place()
sleep(.1)
end
function cutTree
turtle.dig()
turtle.forward()
end
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while true do
if turtle.detectDown() then
break
else
turtle.down()
end
end
turtle.back()
end






thanks in advance to any replies
Lyqyd #2
Posted 14 August 2013 - 08:54 PM
Split into new topic.

So, something like,


local e, char = os.pullEvent("char")
if char == "e" then

?