Advertisement
demon012

MainComputer

Jul 26th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. MainComputer = {aeTimerID = nil}
  2.  
  3. comp = MainComputer
  4.  
  5. while true do
  6.     event, param1, param2, param3 = os.pullEvent()
  7.     if event == "redstone" then -- redstone, nil, nil, nil
  8.         if colors.test(rs.getBundledInput('bottom'), colors.green) then
  9.             seconds = 300
  10.             print('Powering on AE for ' .. seconds .. ' seconds')
  11.             comp.aeTimerID = os.startTimer(seconds)
  12.             outputs = rs.getBundledInput('bottom')
  13.             outputs = colors.combine(outputs, colors.red)
  14.             rs.setBundledOutput('bottom', colors.red)
  15.         end
  16.     elseif event == "timer" then -- timer, timerid, nil, nil
  17.         if param1 == comp.aeTimerID then
  18.             print('Turning off the AE system.')
  19.             outputs = rs.getBundledOutput('bottom')
  20.             outputs = colors.subtract(outputs, colors.red)
  21.             rs.setBundledOutput('bottom', outputs)
  22.         end
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement