Don't like ads? PRO users don't see any ads ;-)
Guest

ComputerCraft - Mass Fabricator v0.2

By: Eleri on Jun 16th, 2012  |  syntax: Lua  |  size: 1.09 KB  |  hits: 86  |  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. --[[
  2.         Mass Fabricator
  3.  
  4. ]]
  5.  
  6. local VERSION = 0.2
  7.  
  8. term.clear()
  9.  
  10. -- Clear any extraneous redstone commands
  11. redstone.setBundledOutput( "right", 0 )
  12.  
  13. -- Define variables
  14. local cPulse
  15. local nCount = 0
  16. local nTimer = 2
  17. local timer = os.startTimer(nTimer)
  18.  
  19. -- Redpower 2 requires pulses, so every time a redstone signal is sent it's pulsed once
  20. function bundledPulse( sSide, nColors )
  21.         redstone.setBundledOutput( sSide, nColors )
  22.         statusScreen()
  23.         sleep(0.2)
  24.         redstone.setBundledOutput( sSide, 0 )
  25. end
  26.  
  27. -- Visual feedback and check of the system
  28. function banner()
  29.         term.clear()
  30.         term.setCursorPos(1,1)
  31.         print( "Mass Fabricator Program, Version "..VERSION )
  32.         print( "" )
  33. end
  34.  
  35. function statusScreen()
  36.         banner()
  37.         print("Running...I hope...")
  38. end
  39.  
  40. while true do
  41.         local event
  42.         event = os.pullEvent()
  43.         if event == "timer" then
  44.                 if nCount == 2 then
  45.                         nCount = 1
  46.                 else
  47.                         nCount = nCount + 1
  48.                 end
  49.                 timer = os.startTimer(nTimer)
  50.                 cPulse = colors.white
  51.                 if nCount % 2 == 0 then
  52.                         cPulse = colors.combine( cPulse + colors.black )
  53.                 end
  54.                 bundledPulse( "right", cPulse )
  55.         end
  56. end