Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Vault program

By: a guest on Feb 7th, 2013  |  syntax: Lua  |  size: 2.85 KB  |  views: 56  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. -- Hi, this is the lock-part of my vault framedoor system.
  2. -- The problem im having, is that when i run the 2nd program (bundled controle program), i get this error:
  3. -- "door:3: Too long without yeilding"
  4. -- I cant figure out what the problem is, I need help! D:
  5.  
  6. Program 1: Lock program (This program works fine, just wanted to include it so you could see the entire system)
  7.  
  8. term.clear()
  9. term.setCursorPos(2, 1)
  10. term.write("-------------------------------------------------")
  11. term.setCursorPos(2, 1)
  12. term.write("-------------------------------------------------")
  13.  
  14. function Write()
  15.   term.write("|")
  16.   end
  17.  
  18. for i=1,17 do
  19.   term.setCursorPos(51, i+1)
  20.   Write()
  21. end
  22.  
  23. for i=1,17
  24.   term.setCursorPos(1, i+1)
  25.   Write()
  26. end
  27.  
  28. term.setCursorPos(15, 7)
  29. term.write("The vault is locked!")
  30. term.setCursorPos(21, 9)
  31. term.write("Password: ")
  32. term.setCursorPos(21, 10)
  33.  
  34. X = read("*")
  35. pass = "Notrelevant"
  36. pass2 = "Notrelevant"
  37. pass3 = "Notrelevant"
  38.  
  39. if X == pass then
  40.   term.setCursorPos(19, 11)
  41.   term.write("password #2: ")
  42.   term.setCursorPos(21, 12)
  43.   sleep(1)
  44.    Y = read("*")
  45.    if Y == pass2 then
  46.      term.setCursorPos(19, 13)
  47.          term.write("Password #3: ")
  48.          term.setCursorPos(21, 14)
  49.          sleep(1)
  50.           Z = read("*")
  51.            if Z == pass3 then
  52.              term.setCursorPos(14, 15)
  53.                  term.write("Correct, you may enter")
  54.                  redstone.setOutput("left", true)
  55.                  sleep(3)
  56.                  redstone.setOutput("left", false)
  57.                  sleep(3)
  58.                  os.reboot()
  59.                  end
  60.             else
  61.                 term.setCursorPos(21, 15)
  62.                 term.write("False, try again")
  63.                 sleep(3)
  64.                 os.reboot()
  65.                 end
  66.            else
  67.            term.setCursorPos(21, 13)
  68.            term.write("False, try again")
  69.            sleep(3)
  70.            os.reboot()
  71.            end
  72.           else
  73.           term.setCursorPos(21, 11)
  74.           term.write("False, try again")
  75.           sleep(3)
  76.           os.reboot()
  77.           end
  78. sleep(3)
  79. os.reboot
  80.  
  81. Now, here is the 2nd program. There is a red alloy wire from the left of computer #1 to the left of computer #2, which is behind a wall. Computer #1 is in the wall.
  82. I intend Computer #2 to open a frame door, when it recieves a redstone signal from Computer #1.
  83. I want it to also close the frame door, when its provided with a redstone signal, under computer #2.
  84.  
  85.  
  86. while true do
  87. i = 0
  88.  
  89. if(redstone.getInput("left")) then
  90.  
  91. function open()
  92. rs.setBundledOutput("right", colors.orange)
  93. sleep(.5)
  94. c = colors.subtract(colors.orange)
  95. rs.setBundledOutput("right", c)
  96. sleep(.5)
  97. end
  98.  
  99. open()
  100. open()
  101. pulse = i+2
  102. limit = 2
  103.  
  104. elseif pulse == limit then
  105.   redstonedown = redstone.getInput("bottom")
  106.   if redstonedown == true then
  107.  
  108. function close()
  109. rs.setBundledOutput("right", colors.white)
  110. sleep(.5)
  111. Y = colors.subtract(colors.white)
  112. rs.setBundledOutput("right", Y)
  113. sleep(.5)
  114. end
  115.  
  116. close()
  117. close()
  118. pulse = i-2
  119. end
  120. end
  121. end
  122. sleep(3)
  123. os.reboot()
  124.  
  125.  
  126. Upon running this program, I get this error:
  127.  
  128. door:3: Too long without yeilding
  129.  
  130. Please help me D:
clone this paste RAW Paste Data