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

10 out put

Started by cmurtheepic, 10 July 2012 - 06:17 AM
cmurtheepic #1
Posted 10 July 2012 - 08:17 AM
hey when ever i use [while true do] in my code when ever i run it i get 10 in stead of the program like soo
>door
10
>
and that is how i get it
plz help me[attachment=305:door.txt]
xuma202 #2
Posted 10 July 2012 - 09:59 AM
I've fixed it for you. Hope that's the way you want it to act


while true do
  term.clear()
  term.setCursorPos(1,1)
  print ("open or close-")
  x = io.read()
  if x == "open" then
    redstone.setOutput("right", true )
    sleep(1)
    redstone.setOutput("right", false )
    sleep(1)
    redstone.setOutput("right", true )
    sleep(1)
    redstone.setOutput("right", false )
    sleep(1)
    redstone.setOutput("right", true )
    sleep(1)
    redstone.setOutput("right", false )
  elseif x == "close" then
    redstone.setOutput("left", true )
    sleep(1)
    redstone.setOutput("left", false )
    sleep(1)
    redstone.setOutput("left", true )
    sleep(1)
    redstone.setOutput("left", false )
    sleep(1)
    redstone.setOutput("left", true )
    sleep(1)
    redstone.setOutput("left", false )
  end
  sleep(0.1)
end
cmurtheepic #3
Posted 10 July 2012 - 06:24 PM
thanks i appereaciate your help