svdragster

Untitled

Sep 12th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. function makeTop()
  2.     term.setBackgroundColor(colors.white)
  3.     term.setCursorPos(1, 1)
  4.     term.clearLine()
  5.     term.setCursorPos(1, 1)
  6.     term.setTextColor(colors.red)
  7.     write("Turtledurtle 3")
  8. end
  9.  
  10. function fillScreen(color)
  11.     term.setCursorPos(1, 1)
  12.     term.setBackgroundColor(color)
  13.     term.clear()
  14.     makeTop()
  15. end
  16.  
  17. sizeX, sizeY = term.getSize()
  18.  
  19. n = 0
  20.  
  21. state = 0 -- 0 = empty, 1 = alert
  22.  
  23. if (not rednet.isOpen("back")) then
  24.     rednet.open("back")
  25. end
  26.  
  27. fillScreen(colors.lightBlue)
  28. term.setCursorPos(1, 1)
  29. while true do
  30.     local id, message = rednet.receive(3)
  31.     if (message == nil) then
  32.         message = " "
  33.     end
  34.    
  35.     local continue = true
  36.    
  37.     if (message == " ") then
  38.         if (state ~= 0) then
  39.             state = 0
  40.             fillScreen(colors.lime)
  41.         end
  42.         continue = false
  43.     else
  44.         if (state ~= 1) then
  45.             state = 1
  46.             fillScreen(colors.yellow)
  47.             term.setCursorPos(1, 3)
  48.         end
  49.     end
  50.    
  51.     if (continue) then
  52.         --n = n + 1
  53.         --term.setCursorPos(1, cY + 1)
  54.        
  55.         term.setBackgroundColor(colors.yellow)
  56.         term.setTextColor(colors.gray)
  57.         print(message)
  58.         term.scroll(1)
  59.         local cX, cY = term.getCursorPos()
  60.         makeTop()
  61.         term.setCursorPos(1, cY)
  62.         --[[if cY >= sizeY  then
  63.             cY = cY - 1
  64.             --n = 15
  65.             --term.scroll(1)
  66.             makeTop()
  67.             term.setCursorPos(1, cY)
  68.         end--]]
  69.     end
  70. end
Advertisement
Add Comment
Please, Sign In to add comment