MCFunRide

Simple Startup Script [By: neluxjanz]

Jun 30th, 2015
331
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local w,h = term.getSize()
  2. local wm, hm, monitor
  3. local machine = "back"
  4. local lights = "right"
  5. local Monitor = "top"
  6. local Modem = "left"
  7. local password = "necas"
  8. local opentime = 120
  9. local systime = 2
  10. local title = "Welcome NeluxOS"
  11. local iniText = "Iniciating system test"
  12. local lightsText = "Lights on?"
  13. local lightsOtext = "Lights stay off"
  14. local passwordText = "Password:"
  15. local passwordCtext = "Password correct!"
  16. local passwordItext = "Password incorrect!"
  17. local factoryWtext = "Factory is working..."
  18. local factoryStext = "Factory has stop"
  19. function startMonitor()
  20. peripheral.call(Monitor, "write", "Test")
  21. monitor = peripheral.wrap(Monitor)
  22. wm, hm = monitor.getSize()
  23. end
  24. function clearScreen()
  25. term.clear()
  26. term.setBackgroundColor(colors.black)
  27. term.setTextColor(colors.green)
  28. monitor.clear()
  29. monitor.setBackgroundColor(colors.black)
  30. monitor.setTextColor(colors.green)
  31. monitor.setTextScale(.5)
  32. end
  33. function cleanline()
  34. monitor.clearLine(2,x)
  35. term.clearLine(2,x)
  36. end
  37. function screenTpos()
  38. term.setCursorPos(1,1)
  39. monitor.setCursorPos(1,1)
  40. end
  41. function screenGpos()
  42. term.setCursorPos(1,2)
  43. monitor.setCursorPos(1,2)
  44. end
  45. function startModem()
  46. modem = peripheral.wrap(Modem)
  47. modem.open(0)
  48. modem.isOpen(0)
  49. --modem.closeAll()
  50. end
  51. x = function()
  52. print(t)
  53. monitor.write(t,wm)
  54. modem.transmit(0,1,t)
  55. end
  56. startMonitor()
  57. startModem()
  58. for k,v in pairs(peripheral.getMethods(Monitor)) do
  59. print(v)
  60. print("Terminal size = " .. w .. "," .. h)
  61. print("Monitor size = " .. wm .. "," .. hm)
  62. end
  63. clearScreen()
  64. screenTpos()
  65. t = title
  66. x()
  67. sleep(systime)
  68. screenGpos()
  69. t = iniText
  70. x()
  71.  
  72. sleep(systime)
  73. sleep(4)
  74. cleanline()
  75. while true do
  76.  
  77. screenGpos()
  78. t = lightsText
  79. x()
  80. local input = read()
  81. if input == "yes" then
  82. cleanline()
  83. screenGpos()
  84. rs.setOutput(lights,true)
  85. else
  86. cleanline()
  87. screenGpos()
  88. t = lightsOtext
  89. x()
  90. end
  91. cleanline()
  92. screenGpos()
  93. t = passwordText
  94. x()
  95. local input = read("*")
  96. if input == password then
  97. cleanline()
  98. screenGpos()
  99. t = passwordCtext
  100. x()
  101. sleep(systime)
  102. rs.setOutput(machine,true)
  103. cleanline()
  104. screenGpos()
  105. t = factoryWtext
  106. x()
  107. sleep(opentime)
  108. screenGpos()
  109. rs.setOutput(machine,false)
  110. t = factoryStext
  111. x()
  112. cleanline()
  113. screenGpos()
  114. else
  115. t = passwordItext
  116. x()
  117. sleep(2)
  118. os.shutdown()
  119. --shell.run(boolean)
  120. clearScreen()
  121. screenTpos()
  122. end
  123. end
RAW Paste Data