0

I'm trying to make a harvester/planter out of computercraft computers, and I can get a redstone pulse consistent with a crop maturing, but cannot loop my command redstone.getInput("front") to keep checking without the program crashing.

-- Harvest Program
    --inf loop
while true do
    -- Redstatus is just a bool variable
    if RedStatus = redstone.getInput("front") then
    rednet.send(1, "shell.run("Harvest")")
end
4
  • link this is part of one (works)
    – user161362
    Commented Aug 5, 2016 at 17:29
  • link This is the other part to this one (doesn't work)
    – user161362
    Commented Aug 5, 2016 at 17:33
  • is a lone then without a corresponding end allowed?
    – Sumurai8
    Commented Aug 7, 2016 at 13:41
  • @Sumurai8 'then' and 'end' statements are not necessarily paired, 'if' and 'then' are, and also 'while true do' and 'end' are paired
    – user161362
    Commented Aug 7, 2016 at 14:31

1 Answer 1

1

Call os.sleep(x) at the end of your loop. The loop will then be executed every x seconds.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .