Advertisement
Guest User

startup

a guest
Jun 20th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. m = peripheral.wrap("left")
  2. modem = peripheral.wrap("back")
  3. modem.open(55001)
  4. status = 0
  5. -- -------------Wej?cie-----------------------------
  6. m.setCursorPos(6,7)
  7. m.setTextScale(2)
  8. m.setBackgroundColour(colors.black)
  9. m.setTextColour(colors.white)
  10. m.clear()
  11. m.write("Touch monitor to continue")
  12. os.pullEvent("monitor_touch")
  13. -- ----------------------------MENU-----------------------------------
  14. m.clear()
  15. m.setCursorPos(2,18)
  16. m.setTextColour(colors.lightBlue)
  17. m.setTextScale(1)
  18. m.write("log out")
  19. win = window.create(m ,23,1,27,3)
  20. win.setBackgroundColour(colors.lightBlue)
  21. win.setTextColour(colors.red)
  22. win.clear()
  23. win.setCursorPos(8,2)
  24. win.write("ASTIOMAT 3000")
  25. event, side, port, respPort, msg = os.pullEvent("modem_message")
  26.  
  27. print("Pos x:" .. msg[1])
  28. print("Pos y:" .. msg[2])
  29.  
  30. if posx >= 1 and posx <= 8 and posy >= 17  and posy <= 19 then
  31.         os.reboot()
  32. end
  33. win.setVisible(false)
  34. -- ---------------------------------------------------------------
  35. m.setCursorPos(5,3)
  36. m.setTextScale(4)
  37. m.setBackgroundColour(colors.green)
  38. m.setTextColour(colors.blue)
  39. m.clear()
  40. m.write("[INACTIVE]")
  41. -- ---------------Funkcja Zapasowaj energi-------------------------
  42. --local function reserv()
  43.     while true do
  44.         os.pullEvent("monitor_touch")
  45.         status = status + 1
  46.  
  47.         if status >= 2 then
  48.             status = 0
  49.         end
  50.         if status == 1 then
  51.             m.setCursorPos(6,3)
  52.             m.setTextScale(4)
  53.             m.setTextColour(colors.blue)
  54.             m.setBackgroundColour(colors.red)
  55.             m.clear()
  56.             m.write("[ACTIVE]")
  57.             peripheral.call("back", "transmit", 55000, 1, "POWER")
  58.         end
  59.         if status == 0 then
  60.             m.setCursorPos(5,3)
  61.             m.setBackgroundColour(colors.green)
  62.             m.clear()
  63.             m.write("[INACTIVE]")
  64.             peripheral.call("back", "transmit", 55000, 1, "STOP")
  65.         end
  66.     end
  67. --end
  68. -- ----------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement