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

I'm trying to automate a mining device but can't find error

Started by Alex7055, 19 June 2014 - 01:15 AM
Alex7055 #1
Posted 19 June 2014 - 03:15 AM
Ok so here is the code
redstone.getInput("top")
if true then do
redstone.Output("left" , true)
sleep (1)
redstone.Output("front" , true)
sleep (2)
redstone.Output("front" , false)
sleep (3)
redstone.Output("front" , true)
sleep (1)
redstone.Output("front" , false)
end end

and the error is this
lua :3: attempt to call nil

is there something I'm missing if so please tell me
Lyqyd #2
Posted 19 June 2014 - 03:22 AM
You're looking for redstone.setOutput, not redstone.Output. Also, you're confused as to how conditionals work. "if true then" will ALWAYS run the code inside it. This may be more what you were trying to do:


if redstone.getInput("top") then
    redstone.setOutput("left" , true)
    sleep(1)
    redstone.setOutput("front" , true)
    sleep(2)
    redstone.setOutput("front" , false)
    sleep(3)
    redstone.setOutput("front" , true)
    sleep(1)
    redstone.setOutput("front" , false)
end