Advertisement
Guest User

light.lua

a guest
Sep 24th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. local mon = peripheral.find "monitor"
  2. local wasCol = colors.green
  3.  
  4. while true do
  5.     local r = math.random()
  6.     local col = nil
  7.    
  8.     if wasCol == colors.red then
  9.         col = colors.orange    
  10.     elseif wasCol == colors.orange then
  11.         if r >= 0.5 then
  12.             col = colors.green
  13.         else
  14.             col = colors.red
  15.         end        
  16.     elseif wasCol == colors.green then
  17.         col = colors.red
  18.     end
  19.    
  20.     mon.setBackgroundColor(col)
  21.     mon.clear()
  22.    
  23.     wasCol = col
  24.    
  25.     sleep(3)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement