Miner8149

Nova Server

Jun 24th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 51.01 KB | None | 0 0
  1. local monitors = {peripheral.find("monitor")}
  2. local mon = monitors[1]
  3.  
  4. local StartX = 12
  5. local StartY = 4
  6.  
  7. local state1 = "OFF"
  8. local state2 = "OFF"
  9. local state3 = "OFF"
  10. local state4 = "OFF"
  11. local state5 = "OFF"
  12. local state6 = "OFF"
  13. local state7 = "OFF"
  14. local state8 = "OFF"
  15. local state9 = "OFF"
  16. local state10 = "OFF"
  17. local state11 = "OFF"
  18. local state12 = "OFF"
  19. local state13 = "OFF"
  20. local state14 = "OFF"
  21. local state15 = "OFF"
  22. local state16 = "OFF"
  23. local state17 = "OFF"
  24. local state18 = "OFF"
  25. local state19 = "OFF"
  26. local state20 = "OFF"
  27. local state21 = "OFF"
  28. local state22 = "OFF"
  29. local state23 = "OFF"
  30. local state24 = "OFF"
  31. local state25 = "OFF"
  32. local state26 = "OFF"
  33. local state27 = "OFF"
  34. local state28 = "OFF"
  35. local state29 = "OFF"
  36. local state30 = "OFF"
  37. local state31 = "OFF"
  38. local state32 = "OFF"
  39.  
  40. local synStateColor1 = colors.red
  41. local synStateColor2 = colors.red
  42. local synStateColor3 = colors.red
  43. local synStateColor4 = colors.red
  44. local synStateColor5 = colors.red
  45. local synStateColor6 = colors.red
  46. local synStateColor7 = colors.red
  47. local synStateColor8 = colors.red
  48. local synStateColor9 = colors.red
  49. local synStateColor10 = colors.red
  50. local synStateColor11 = colors.red
  51. local synStateColor12 = colors.red
  52. local synStateColor13 = colors.red
  53. local synStateColor14 = colors.red
  54. local synStateColor15 = colors.red
  55. local synStateColor16 = colors.red
  56. local synStateColor17 = colors.red
  57. local synStateColor18 = colors.red
  58. local synStateColor19 = colors.red
  59. local synStateColor20 = colors.red
  60. local synStateColor21 = colors.red
  61. local synStateColor22 = colors.red
  62. local synStateColor23 = colors.red
  63. local synStateColor24 = colors.red
  64. local synStateColor25 = colors.red
  65. local synStateColor26 = colors.red
  66. local synStateColor27 = colors.red
  67. local synStateColor28 = colors.red
  68. local synStateColor29 = colors.red
  69. local synStateColor30 = colors.red
  70. local synStateColor31 = colors.red
  71. local synStateColor32 = colors.red
  72.  
  73. local synColor1 = 0
  74. local synColor2 = 0
  75. local synColor3 = 0
  76. local synColor4 = 0
  77. local synColor5 = 0
  78. local synColor6 = 0
  79. local synColor7 = 0
  80. local synColor8 = 0
  81. local synColor9 = 0
  82. local synColor10 = 0
  83. local synColor11 = 0
  84. local synColor12 = 0
  85. local synColor13 = 0
  86. local synColor14 = 0
  87. local synColor15 = 0
  88. local synColor16 = 0
  89. local synColor17 = 0
  90. local synColor18 = 0
  91. local synColor19 = 0
  92. local synColor20 = 0
  93. local synColor21 = 0
  94. local synColor22 = 0
  95. local synColor23 = 0
  96. local synColor24 = 0
  97. local synColor25 = 0
  98. local synColor26 = 0
  99. local synColor27 = 0
  100. local synColor28 = 0
  101. local synColor29 = 0
  102. local synColor30 = 0
  103. local synColor31 = 0
  104. local synColor32 = 0
  105.  
  106. term.clear()
  107. mon.setTextScale(0.5)
  108. term.setCursorPos(1,1)
  109. term.write("Server ID: "..os.getComputerID())
  110. term.setCursorPos(1,2)
  111. term.write("Waiting for input from Pocket Computer...")
  112. term.setCursorPos(1,3)
  113.  
  114. local fileName = "server"
  115.  
  116. --Save Code
  117. function saveGame()
  118.   fs.delete("saves/"..fileName)
  119.   local file = fs.open("saves/"..fileName,"a")
  120.     file.writeLine(fileName)
  121.     file.writeLine(status1)
  122.     file.writeLine(status2)
  123.     file.writeLine(status3)
  124.     file.writeLine(status4)
  125.     file.writeLine(status5)
  126.     file.writeLine(status6)
  127.     file.writeLine(status7)
  128.     file.writeLine(status8)
  129.     file.writeLine(status9)
  130.     file.writeLine(status10)
  131.     file.writeLine(status11)
  132.     file.writeLine(status12)
  133.     file.writeLine(status13)
  134.     file.writeLine(status14)
  135.     file.writeLine(status15)
  136.     file.writeLine(status16)
  137.     file.writeLine(status17)
  138.     file.writeLine(status18)
  139.     file.writeLine(status19)
  140.     file.writeLine(status20)
  141.     file.writeLine(status21)
  142.     file.writeLine(status22)
  143.     file.writeLine(status23)
  144.     file.writeLine(status24)
  145.     file.writeLine(status25)
  146.     file.writeLine(status26)
  147.     file.writeLine(status27)
  148.     file.writeLine(status28)
  149.     file.writeLine(status29)
  150.     file.writeLine(status30)
  151.     file.writeLine(status31)
  152.     file.writeLine(status32)
  153.   file.close()
  154.   saveGame2()
  155. end
  156. function saveGame2()
  157.   fs.delete("saves/"..fileName.."2")
  158.   local file = fs.open("saves/"..fileName.."2","a")
  159.     file.writeLine(synStateColor1)
  160.     file.writeLine(synStateColor2)
  161.     file.writeLine(synStateColor3)
  162.     file.writeLine(synStateColor4)
  163.     file.writeLine(synStateColor5)
  164.     file.writeLine(synStateColor6)
  165.     file.writeLine(synStateColor7)
  166.     file.writeLine(synStateColor8)
  167.     file.writeLine(synStateColor9)
  168.     file.writeLine(synStateColor10)
  169.     file.writeLine(synStateColor11)
  170.     file.writeLine(synStateColor12)
  171.     file.writeLine(synStateColor13)
  172.     file.writeLine(synStateColor14)
  173.     file.writeLine(synStateColor15)
  174.     file.writeLine(synStateColor16)
  175.     file.writeLine(synStateColor17)
  176.     file.writeLine(synStateColor18)
  177.     file.writeLine(synStateColor19)
  178.     file.writeLine(synStateColor20)
  179.     file.writeLine(synStateColor21)
  180.     file.writeLine(synStateColor22)
  181.     file.writeLine(synStateColor23)
  182.     file.writeLine(synStateColor24)
  183.     file.writeLine(synStateColor25)
  184.     file.writeLine(synStateColor26)
  185.     file.writeLine(synStateColor27)
  186.     file.writeLine(synStateColor28)
  187.     file.writeLine(synStateColor29)
  188.     file.writeLine(synStateColor30)
  189.     file.writeLine(synStateColor31)
  190.     file.writeLine(synStateColor32)
  191.   file.close()
  192.   saveGame3()
  193. end
  194. function saveGame3()
  195.   fs.delete("saves/"..fileName.."3")
  196.   local file = fs.open("saves/"..fileName.."3","a")
  197.     file.writeLine(synColor1)
  198.     file.writeLine(synColor2)
  199.     file.writeLine(synColor3)
  200.     file.writeLine(synColor4)
  201.     file.writeLine(synColor5)
  202.     file.writeLine(synColor6)
  203.     file.writeLine(synColor7)
  204.     file.writeLine(synColor8)
  205.     file.writeLine(synColor9)
  206.     file.writeLine(synColor10)
  207.     file.writeLine(synColor11)
  208.     file.writeLine(synColor12)
  209.     file.writeLine(synColor13)
  210.     file.writeLine(synColor14)
  211.     file.writeLine(synColor15)
  212.     file.writeLine(synColor16)
  213.     file.writeLine(synColor17)
  214.     file.writeLine(synColor18)
  215.     file.writeLine(synColor19)
  216.     file.writeLine(synColor20)
  217.     file.writeLine(synColor21)
  218.     file.writeLine(synColor22)
  219.     file.writeLine(synColor23)
  220.     file.writeLine(synColor24)
  221.     file.writeLine(synColor25)
  222.     file.writeLine(synColor26)
  223.     file.writeLine(synColor27)
  224.     file.writeLine(synColor28)
  225.     file.writeLine(synColor29)
  226.     file.writeLine(synColor30)
  227.     file.writeLine(synColor31)
  228.     file.writeLine(synColor32)
  229.   file.close()
  230. end
  231.  
  232. function loadSave1()
  233.   -- Load Save
  234.   local file = fs.open("saves/"..fileName,"r")
  235.   local fileData = {}
  236.   local line = file.readLine()
  237.   repeat
  238.     table.insert(fileData,line)
  239.     line = file.readLine()
  240.   until line == nil
  241.     local fileName = fileData[1]
  242.     state1 = fileData[2]
  243.     state2 = fileData[3]
  244.     state3 = fileData[4]
  245.     state4 = fileData[5]
  246.     state5 = fileData[6]
  247.     state6 = fileData[7]
  248.     state7 = fileData[8]
  249.     state8 = fileData[9]
  250.     state9 = fileData[10]
  251.     state10 = fileData[11]
  252.     state11 = fileData[12]
  253.     state12 = fileData[13]
  254.     state13 = fileData[14]
  255.     state14 = fileData[15]
  256.     state15 = fileData[16]
  257.     state16 = fileData[17]
  258.     state17 = fileData[18]
  259.     state18 = fileData[19]
  260.     state19 = fileData[20]
  261.     state20 = fileData[21]
  262.     state21 = fileData[22]
  263.     state22 = fileData[23]
  264.     state23 = fileData[24]
  265.     state24 = fileData[25]
  266.     state25 = fileData[26]
  267.     state26 = fileData[27]
  268.     state27 = fileData[28]
  269.     state28 = fileData[29]
  270.     state29 = fileData[30]
  271.     state30 = fileData[31]
  272.     state31 = fileData[32]
  273.     state32 = fileData[33]
  274.   file.close()
  275.   loadSave2()
  276. end
  277. function loadSave2()
  278.     -- Load Save
  279.   local file = fs.open("saves/"..fileName.."2","r")
  280.   local fileData = {}
  281.   local line = file.readLine()
  282.   repeat
  283.     table.insert(fileData,line)
  284.     line = file.readLine()
  285.   until line == nil
  286.     synStateColor1 = fileData[1]
  287.     synStateColor2 = fileData[2]
  288.     synStateColor3 = fileData[3]
  289.     synStateColor4 = fileData[4]
  290.     synStateColor5 = fileData[5]
  291.     synStateColor6 = fileData[6]
  292.     synStateColor7 = fileData[7]
  293.     synStateColor8 = fileData[8]
  294.     synStateColor9 = fileData[9]
  295.     synStateColor10 = fileData[10]
  296.     synStateColor11 = fileData[11]
  297.     synStateColor12 = fileData[12]
  298.     synStateColor13 = fileData[13]
  299.     synStateColor14 = fileData[14]
  300.     synStateColor15 = fileData[15]
  301.     synStateColor16 = fileData[16]
  302.     synStateColor17 = fileData[17]
  303.     synStateColor18 = fileData[18]
  304.     synStateColor19 = fileData[19]
  305.     synStateColor20 = fileData[20]
  306.     synStateColor21 = fileData[21]
  307.     synStateColor22 = fileData[22]
  308.     synStateColor23 = fileData[23]
  309.     synStateColor24 = fileData[24]
  310.     synStateColor25 = fileData[25]
  311.     synStateColor26 = fileData[26]
  312.     synStateColor27 = fileData[27]
  313.     synStateColor28 = fileData[28]
  314.     synStateColor29 = fileData[29]
  315.     synStateColor30 = fileData[30]
  316.     synStateColor31 = fileData[31]
  317.     synStateColor32 = fileData[32]
  318.   file.close()
  319.   loadSave3()
  320. end
  321. function loadSave3()
  322.     -- Load Save
  323.   local file = fs.open("saves/"..fileName.."3","r")
  324.   local fileData = {}
  325.   local line = file.readLine()
  326.   repeat
  327.     table.insert(fileData,line)
  328.     line = file.readLine()
  329.   until line == nil
  330.     synColor1 = fileData[1]
  331.     synColor2 = fileData[2]
  332.     synColor3 = fileData[3]
  333.     synColor4 = fileData[4]
  334.     synColor5 = fileData[5]
  335.     synColor6 = fileData[6]
  336.     synColor7 = fileData[7]
  337.     synColor8 = fileData[8]
  338.     synColor9 = fileData[9]
  339.     synColor10 = fileData[10]
  340.     synColor11 = fileData[11]
  341.     synColor12 = fileData[12]
  342.     synColor13 = fileData[13]
  343.     synColor14 = fileData[14]
  344.     synColor15 = fileData[15]
  345.     synColor16 = fileData[16]
  346.     synColor17 = fileData[17]
  347.     synColor18 = fileData[18]
  348.     synColor19 = fileData[19]
  349.     synColor20 = fileData[20]
  350.     synColor21 = fileData[21]
  351.     synColor22 = fileData[22]
  352.     synColor23 = fileData[23]
  353.     synColor24 = fileData[24]
  354.     synColor25 = fileData[25]
  355.     synColor26 = fileData[26]
  356.     synColor27 = fileData[27]
  357.     synColor28 = fileData[28]
  358.     synColor29 = fileData[29]
  359.     synColor30 = fileData[30]
  360.     synColor31 = fileData[31]
  361.     synColor32 = fileData[32]
  362.   file.close()
  363.   loadSave4()
  364. end
  365.  
  366. function loadSave4()
  367.   synStateColor1 = tonumber(synStateColor1)
  368.   synStateColor2 = tonumber(synStateColor2)
  369.   synStateColor3 = tonumber(synStateColor3)
  370.   synStateColor4 = tonumber(synStateColor4)
  371.   synStateColor5 = tonumber(synStateColor5)
  372.   synStateColor6 = tonumber(synStateColor6)
  373.   synStateColor7 = tonumber(synStateColor7)
  374.   synStateColor8 = tonumber(synStateColor8)
  375.   synStateColor9 = tonumber(synStateColor9)
  376.   synStateColor10 = tonumber(synStateColor10)
  377.   synStateColor11 = tonumber(synStateColor11)
  378.   synStateColor12 = tonumber(synStateColor12)
  379.   synStateColor13 = tonumber(synStateColor13)
  380.   synStateColor14 = tonumber(synStateColor14)
  381.   synStateColor15 = tonumber(synStateColor15)
  382.   synStateColor16 = tonumber(synStateColor16)
  383.   synStateColor17 = tonumber(synStateColor17)
  384.   synStateColor18 = tonumber(synStateColor18)
  385.   synStateColor19 = tonumber(synStateColor19)
  386.   synStateColor20 = tonumber(synStateColor20)
  387.   synStateColor21 = tonumber(synStateColor21)
  388.   synStateColor22 = tonumber(synStateColor22)
  389.   synStateColor23 = tonumber(synStateColor23)
  390.   synStateColor24 = tonumber(synStateColor24)
  391.   synStateColor25 = tonumber(synStateColor25)
  392.   synStateColor26 = tonumber(synStateColor26)
  393.   synStateColor27 = tonumber(synStateColor27)
  394.   synStateColor28 = tonumber(synStateColor28)
  395.   synStateColor29 = tonumber(synStateColor29)
  396.   synStateColor30 = tonumber(synStateColor30)
  397.   synStateColor31 = tonumber(synStateColor31)
  398.   synStateColor32 = tonumber(synStateColor32)
  399.   loadSave5()
  400. end
  401. function loadSave5()
  402.   synColor1 = tonumber(synColor1)
  403.   synColor2 = tonumber(synColor2)
  404.   synColor3 = tonumber(synColor3)
  405.   synColor4 = tonumber(synColor4)
  406.   synColor5 = tonumber(synColor5)
  407.   synColor6 = tonumber(synColor6)
  408.   synColor7 = tonumber(synColor7)
  409.   synColor8 = tonumber(synColor8)
  410.   synColor9 = tonumber(synColor9)
  411.   synColor10 = tonumber(synColor10)
  412.   synColor11 = tonumber(synColor11)
  413.   synColor12 = tonumber(synColor12)
  414.   synColor13 = tonumber(synColor13)
  415.   synColor14 = tonumber(synColor14)
  416.   synColor15 = tonumber(synColor15)
  417.   synColor16 = tonumber(synColor16)
  418.   synColor17 = tonumber(synColor17)
  419.   synColor18 = tonumber(synColor18)
  420.   synColor19 = tonumber(synColor19)
  421.   synColor20 = tonumber(synColor20)
  422.   synColor21 = tonumber(synColor21)
  423.   synColor22 = tonumber(synColor22)
  424.   synColor23 = tonumber(synColor23)
  425.   synColor24 = tonumber(synColor24)
  426.   synColor25 = tonumber(synColor25)
  427.   synColor26 = tonumber(synColor26)
  428.   synColor27 = tonumber(synColor27)
  429.   synColor28 = tonumber(synColor28)
  430.   synColor29 = tonumber(synColor29)
  431.   synColor30 = tonumber(synColor30)
  432.   synColor31 = tonumber(synColor31)
  433.   synColor32 = tonumber(synColor32)
  434. end
  435.  
  436. function loadSave6()
  437.   -- Make New Save
  438.   local file = fs.open("saves/"..fileName,"a")
  439.     file.writeLine(fileName)
  440.     file.writeLine("OFF")
  441.     file.writeLine("OFF")
  442.     file.writeLine("OFF")
  443.     file.writeLine("OFF")
  444.     file.writeLine("OFF")
  445.     file.writeLine("OFF")
  446.     file.writeLine("OFF")
  447.     file.writeLine("OFF")
  448.     file.writeLine("OFF")
  449.     file.writeLine("OFF")
  450.     file.writeLine("OFF")
  451.     file.writeLine("OFF")
  452.     file.writeLine("OFF")
  453.     file.writeLine("OFF")
  454.     file.writeLine("OFF")
  455.     file.writeLine("OFF")
  456.     file.writeLine("OFF")
  457.     file.writeLine("OFF")
  458.     file.writeLine("OFF")
  459.     file.writeLine("OFF")
  460.     file.writeLine("OFF")
  461.     file.writeLine("OFF")
  462.     file.writeLine("OFF")
  463.     file.writeLine("OFF")
  464.     file.writeLine("OFF")
  465.     file.writeLine("OFF")
  466.     file.writeLine("OFF")
  467.     file.writeLine("OFF")
  468.     file.writeLine("OFF")
  469.     file.writeLine("OFF")
  470.     file.writeLine("OFF")
  471.     file.writeLine("OFF")
  472.   file.close()
  473.   loadSave7()
  474. end
  475. function loadSave7()
  476.   -- Make New Save
  477.   local file = fs.open("saves/"..fileName.."2","a")
  478.     file.writeLine(synStateColor1)
  479.     file.writeLine(synStateColor2)
  480.     file.writeLine(synStateColor3)
  481.     file.writeLine(synStateColor4)
  482.     file.writeLine(synStateColor5)
  483.     file.writeLine(synStateColor6)
  484.     file.writeLine(synStateColor7)
  485.     file.writeLine(synStateColor8)
  486.     file.writeLine(synStateColor9)
  487.     file.writeLine(synStateColor10)
  488.     file.writeLine(synStateColor11)
  489.     file.writeLine(synStateColor12)
  490.     file.writeLine(synStateColor13)
  491.     file.writeLine(synStateColor14)
  492.     file.writeLine(synStateColor15)
  493.     file.writeLine(synStateColor16)
  494.     file.writeLine(synStateColor17)
  495.     file.writeLine(synStateColor18)
  496.     file.writeLine(synStateColor19)
  497.     file.writeLine(synStateColor20)
  498.     file.writeLine(synStateColor21)
  499.     file.writeLine(synStateColor22)
  500.     file.writeLine(synStateColor23)
  501.     file.writeLine(synStateColor24)
  502.     file.writeLine(synStateColor25)
  503.     file.writeLine(synStateColor26)
  504.     file.writeLine(synStateColor27)
  505.     file.writeLine(synStateColor28)
  506.     file.writeLine(synStateColor29)
  507.     file.writeLine(synStateColor30)
  508.     file.writeLine(synStateColor31)
  509.     file.writeLine(synStateColor32)
  510.   file.close()
  511.   loadSave8()
  512. end
  513. function loadSave8()
  514.   -- Make New Save
  515.   local file = fs.open("saves/"..fileName.."3","a")
  516.     file.writeLine(synColor1)
  517.     file.writeLine(synColor2)
  518.     file.writeLine(synColor3)
  519.     file.writeLine(synColor4)
  520.     file.writeLine(synColor5)
  521.     file.writeLine(synColor6)
  522.     file.writeLine(synColor7)
  523.     file.writeLine(synColor8)
  524.     file.writeLine(synColor9)
  525.     file.writeLine(synColor10)
  526.     file.writeLine(synColor11)
  527.     file.writeLine(synColor12)
  528.     file.writeLine(synColor13)
  529.     file.writeLine(synColor14)
  530.     file.writeLine(synColor15)
  531.     file.writeLine(synColor16)
  532.     file.writeLine(synColor17)
  533.     file.writeLine(synColor18)
  534.     file.writeLine(synColor19)
  535.     file.writeLine(synColor20)
  536.     file.writeLine(synColor21)
  537.     file.writeLine(synColor22)
  538.     file.writeLine(synColor23)
  539.     file.writeLine(synColor24)
  540.     file.writeLine(synColor25)
  541.     file.writeLine(synColor26)
  542.     file.writeLine(synColor27)
  543.     file.writeLine(synColor28)
  544.     file.writeLine(synColor29)
  545.     file.writeLine(synColor30)
  546.     file.writeLine(synColor31)
  547.     file.writeLine(synColor32)
  548.   file.close()
  549.   os.sleep(2)
  550.   loadSave()
  551. end
  552.  
  553. --Load Code
  554. function loadSave()
  555.   -- Check if Saves folder Exists
  556.   if fs.exists("saves") then
  557.     -- Check if Save exists
  558.     if fs.exists("saves/"..fileName) and fs.exists("saves/"..fileName.."2") and fs.exists("saves/"..fileName.."3") then
  559.       loadSave1()
  560.     else
  561.       loadSave6()
  562.     end
  563.   else
  564.     -- Make Folder
  565.     fs.makeDir("saves")
  566.     os.sleep(2)
  567.     loadSave()
  568.   end
  569. end
  570.  
  571. function checkState()
  572.   if state1 == "ON " then
  573.     synStateColor1 = colors.lime
  574.     synColor1 = colors.blue
  575.   elseif state1 == "OFF" then
  576.     synStateColor1 = colors.red
  577.     synColor1 = 0
  578.   end
  579.   if state2 == "ON " then
  580.     synStateColor2 = colors.lime
  581.     synColor2 = colors.lightBlue
  582.   elseif state2 == "OFF" then
  583.     synStateColor2 = colors.red
  584.     synColor2 = 0
  585.   end
  586.   if state3 == "ON " then
  587.     synStateColor3 = colors.lime
  588.     synColor3 = colors.pink
  589.   elseif state3 == "OFF" then
  590.     synStateColor3 = colors.red
  591.     synColor3 = 0
  592.   end
  593.   if state4 == "ON " then
  594.     synStateColor4 = colors.lime
  595.     synColor4 = colors.red
  596.   elseif state4 == "OFF" then
  597.     synStateColor4 = colors.red
  598.     synColor4 = 0
  599.   end
  600.   if state5 == "ON " then
  601.     synStateColor5 = colors.lime
  602.     synColor5 = colors.purple
  603.   elseif state5 == "OFF" then
  604.     synStateColor5 = colors.red
  605.     synColor5 = 0
  606.   end
  607.   if state6 == "ON " then
  608.     synStateColor6 = colors.lime
  609.     synColor6 = colors.cyan
  610.   elseif state6 == "OFF" then
  611.     synStateColor6 = colors.red
  612.     synColor6 = 0
  613.   end
  614.   if state7 == "ON " then
  615.     synStateColor7 = colors.lime
  616.     synColor7 = colors.orange
  617.   elseif state7 == "OFF" then
  618.     synStateColor7 = colors.red
  619.     synColor7 = 0
  620.   end
  621.   if state8 == "ON " then
  622.     synStateColor8 = colors.lime
  623.     synColor8 = colors.magenta
  624.   elseif state8 == "OFF" then
  625.     synStateColor8 = colors.red
  626.     synColor8 = 0
  627.   end
  628.   if state9 == "ON " then
  629.     synStateColor9 = colors.lime
  630.     synColor9 = colors.black
  631.   elseif state9 == "OFF" then
  632.     synStateColor9 = colors.red
  633.     synColor9 = 0
  634.   end
  635.   if state10 == "ON " then
  636.     synStateColor10 = colors.lime
  637.     synColor10 = colors.green
  638.   elseif state10 == "OFF" then
  639.     synStateColor10 = colors.red
  640.     synColor10 = 0
  641.   end
  642.   if state11 == "ON " then
  643.     synStateColor11 = colors.lime
  644.     synColor11 = colors.brown
  645.   elseif state11 == "OFF" then
  646.     synStateColor11 = colors.red
  647.     synColor11 = 0
  648.   end
  649.   if state12 == "ON " then
  650.     synStateColor12 = colors.lime
  651.     synColor12 = colors.white
  652.   elseif state12 == "OFF" then
  653.     synStateColor12 = colors.red
  654.     synColor12 = 0
  655.   end
  656.   if state13 == "ON " then
  657.     synStateColor13 = colors.lime
  658.     synColor13 = colors.lightGray
  659.   elseif state13 == "OFF" then
  660.     synStateColor13 = colors.red
  661.     synColor13 = 0
  662.   end
  663.   if state14 == "ON " then
  664.     synStateColor14 = colors.lime
  665.     synColor14 = colors.gray
  666.   elseif state14 == "OFF" then
  667.     synStateColor14 = colors.red
  668.     synColor14 = 0
  669.   end
  670.   if state15 == "ON " then
  671.     synStateColor15 = colors.lime
  672.     synColor15 = colors.lime
  673.   elseif state15 == "OFF" then
  674.     synStateColor15 = colors.red
  675.     synColor15 = 0
  676.   end
  677.   if state16 == "ON " then
  678.     synStateColor16 = colors.lime
  679.     synColor16 = colors.yellow
  680.   elseif state16 == "OFF" then
  681.     synStateColor16 = colors.red
  682.     synColor16 = 0
  683.   end
  684.   checkState2()
  685. end
  686. function checkState2()
  687.   if state17 == "ON " then
  688.     synStateColor17 = colors.lime
  689.     synColor17 = colors.blue
  690.   elseif state17 == "OFF" then          
  691.     synStateColor17 = colors.red        
  692.     synColor17 = 0                      
  693.   end                                    
  694.   if state18 == "ON " then              
  695.     synStateColor18 = colors.lime        
  696.     synColor18 = colors.lightBlue
  697.   elseif state18 == "OFF" then          
  698.     synStateColor18 = colors.red        
  699.     synColor18 = 0                      
  700.   end                                    
  701.   if state19 == "ON " then              
  702.     synStateColor19 = colors.lime        
  703.     synColor19 = colors.pink
  704.   elseif state19 == "OFF" then          
  705.     synStateColor19 = colors.red        
  706.     synColor19 = 0                      
  707.   end                                    
  708.   if state20 == "ON " then              
  709.     synStateColor20 = colors.lime        
  710.     synColor20 = colors.red
  711.   elseif state20 == "OFF" then          
  712.     synStateColor20 = colors.red        
  713.     synColor20 = 0                      
  714.   end                                    
  715.   if state21 == "ON " then              
  716.     synStateColor21 = colors.lime        
  717.     synColor21 = colors.purple
  718.   elseif state21 == "OFF" then          
  719.     synStateColor21 = colors.red        
  720.     synColor21 = 0                      
  721.   end                                    
  722.   if state22 == "ON " then              
  723.     synStateColor22 = colors.lime        
  724.     synColor22 = colors.cyan
  725.   elseif state22 == "OFF" then          
  726.     synStateColor22 = colors.red        
  727.     synColor22 = 0                      
  728.   end                                    
  729.   if state23 == "ON " then              
  730.     synStateColor23 = colors.lime        
  731.     synColor23 = colors.orange
  732.   elseif state23 == "OFF" then          
  733.     synStateColor23 = colors.red        
  734.     synColor23 = 0                      
  735.   end                                    
  736.   if state24 == "ON " then              
  737.     synStateColor24 = colors.lime        
  738.     synColor24 = colors.magenta
  739.   elseif state24 == "OFF" then          
  740.     synStateColor24 = colors.red        
  741.     synColor24 = 0                      
  742.   end                                    
  743.   if state25 == "ON " then              
  744.     synStateColor25 = colors.lime        
  745.     synColor25 = colors.black
  746.   elseif state25 == "OFF" then          
  747.     synStateColor25 = colors.red        
  748.     synColor25 = 0                      
  749.   end                                    
  750.   if state26 == "ON " then              
  751.     synStateColor26 = colors.lime        
  752.     synColor26 = colors.green
  753.   elseif state26 == "OFF" then          
  754.     synStateColor26 = colors.red        
  755.     synColor26 = 0                      
  756.   end                                    
  757.   if state27 == "ON " then              
  758.     synStateColor27 = colors.lime        
  759.     synColor27 = colors.brown
  760.   elseif state27 == "OFF" then          
  761.     synStateColor27 = colors.red        
  762.     synColor27 = 0                      
  763.   end                                    
  764.   if state28 == "ON " then              
  765.     synStateColor28 = colors.lime        
  766.     synColor28 = colors.white
  767.   elseif state28 == "OFF" then          
  768.     synStateColor28 = colors.red        
  769.     synColor28 = 0                      
  770.   end                                    
  771.   if state29 == "ON " then              
  772.     synStateColor29 = colors.lime        
  773.     synColor29 = colors.lightGray
  774.   elseif state29 == "OFF" then          
  775.     synStateColor29 = colors.red        
  776.     synColor29 = 0                      
  777.   end                                    
  778.   if state30 == "ON " then              
  779.     synStateColor30 = colors.lime        
  780.     synColor30 = colors.gray
  781.   elseif state30 == "OFF" then          
  782.     synStateColor30 = colors.red        
  783.     synColor30 = 0                      
  784.   end                                    
  785.   if state31 == "ON " then              
  786.     synStateColor31 = colors.lime        
  787.     synColor31 = colors.lime
  788.   elseif state31 == "OFF" then          
  789.     synStateColor31 = colors.red        
  790.     synColor31 = 0                      
  791.   end                                    
  792.   if state32 == "ON " then              
  793.     synStateColor32 = colors.lime        
  794.     synColor32 = colors.yellow
  795.   elseif state32 == "OFF" then
  796.     synStateColor32 = colors.red
  797.     synColor32 = 0
  798.   end
  799. end
  800.  
  801. function setStateViaColor()
  802.   if synStateColor1 == colors.lime then
  803.     state1 = "ON "
  804.   elseif synStateColor1 == colors.red then
  805.     state1 = "OFF"
  806.   end
  807.   if synStateColor2 == colors.lime then
  808.     state2 = "ON "
  809.   elseif synStateColor2 == colors.red then
  810.     state2 = "OFF"
  811.   end
  812.   if synStateColor3 == colors.lime then
  813.     state3 = "ON "
  814.   elseif synStateColor3 == colors.red then
  815.     state3 = "OFF"
  816.   end
  817.   if synStateColor4 == colors.lime then
  818.     state4 = "ON "
  819.   elseif synStateColor4 == colors.red then
  820.     state4 = "OFF"
  821.   end
  822.   if synStateColor5 == colors.lime then
  823.     state5 = "ON "
  824.   elseif synStateColor5 == colors.red then
  825.     state5 = "OFF"
  826.   end
  827.   if synStateColor6 == colors.lime then
  828.     state6 = "ON "
  829.   elseif synStateColor6 == colors.red then
  830.     state6 = "OFF"
  831.   end
  832.   if synStateColor7 == colors.lime then
  833.     state7 = "ON "
  834.   elseif synStateColor7 == colors.red then
  835.     state7 = "OFF"
  836.   end
  837.   if synStateColor8 == colors.lime then
  838.     state8 = "ON "
  839.   elseif synStateColor8 == colors.red then
  840.     state8 = "OFF"
  841.   end
  842.   if synStateColor9 == colors.lime then
  843.     state9 = "ON "
  844.   elseif synStateColor9 == colors.red then
  845.     state9 = "OFF"
  846.   end
  847.   if synStateColor10 == colors.lime then
  848.     state10 = "ON "
  849.   elseif synStateColor10 == colors.red then
  850.     state10 = "OFF"
  851.   end
  852.   if synStateColor11 == colors.lime then
  853.     state11 = "ON "
  854.   elseif synStateColor11 == colors.red then
  855.     state11 = "OFF"
  856.   end
  857.   if synStateColor12 == colors.lime then
  858.     state12 = "ON "
  859.   elseif synStateColor12 == colors.red then
  860.     state12 = "OFF"
  861.   end
  862.   if synStateColor13 == colors.lime then
  863.     state13 = "ON "
  864.   elseif synStateColor13 == colors.red then
  865.     state13 = "OFF"
  866.   end
  867.   if synStateColor14 == colors.lime then
  868.     state14 = "ON "
  869.   elseif synStateColor14 == colors.red then
  870.     state14 = "OFF"
  871.   end
  872.   if synStateColor15 == colors.lime then
  873.     state15 = "ON "
  874.   elseif synStateColor15 == colors.red then
  875.     state15 = "OFF"
  876.   end
  877.   if synStateColor16 == colors.lime then
  878.     state16 = "ON "
  879.   elseif synStateColor16 == colors.red then
  880.     state16 = "OFF"
  881.   end
  882.   setStateViaColor2()
  883. end
  884. function setStateViaColor2()
  885.   if synStateColor17 == colors.lime then
  886.     state17 = "ON "
  887.   elseif synStateColor17 == colors.red then
  888.     state17 = "OFF"
  889.   end
  890.   if synStateColor18 == colors.lime then
  891.     state18 = "ON "
  892.   elseif synStateColor18 == colors.red then
  893.     state18 = "OFF"
  894.   end
  895.   if synStateColor19 == colors.lime then
  896.     state19 = "ON "
  897.   elseif synStateColor19 == colors.red then
  898.     state19 = "OFF"
  899.   end
  900.   if synStateColor20 == colors.lime then
  901.     state20 = "ON "
  902.   elseif synStateColor20 == colors.red then
  903.     state20 = "OFF"
  904.   end
  905.   if synStateColor21 == colors.lime then
  906.     state21 = "ON "
  907.   elseif synStateColor21 == colors.red then
  908.     state21 = "OFF"
  909.   end
  910.   if synStateColor22 == colors.lime then
  911.     state22 = "ON "
  912.   elseif synStateColor22 == colors.red then
  913.     state22 = "OFF"
  914.   end
  915.   if synStateColor23 == colors.lime then
  916.     state23 = "ON "
  917.   elseif synStateColor23 == colors.red then
  918.     state23 = "OFF"
  919.   end
  920.   if synStateColor24 == colors.lime then
  921.     state24 = "ON "
  922.   elseif synStateColor24 == colors.red then
  923.     state24 = "OFF"
  924.   end
  925.   if synStateColor25 == colors.lime then
  926.     state25 = "ON "
  927.   elseif synStateColor25 == colors.red then
  928.     state25 = "OFF"
  929.   end
  930.   if synStateColor26 == colors.lime then
  931.     state26 = "ON "
  932.   elseif synStateColor26 == colors.red then
  933.     state26 = "OFF"
  934.   end
  935.   if synStateColor27 == colors.lime then
  936.     state27 = "ON "
  937.   elseif synStateColor27 == colors.red then
  938.     state27 = "OFF"
  939.   end
  940.   if synStateColor28 == colors.lime then
  941.     state28 = "ON "
  942.   elseif synStateColor28 == colors.red then
  943.     state28 = "OFF"
  944.   end
  945.   if synStateColor29 == colors.lime then
  946.     state29 = "ON "
  947.   elseif synStateColor29 == colors.red then
  948.     state29 = "OFF"
  949.   end
  950.   if synStateColor30 == colors.lime then
  951.     state30 = "ON "
  952.   elseif synStateColor30 == colors.red then
  953.     state30 = "OFF"
  954.   end
  955.   if synStateColor31 == colors.lime then
  956.     state31 = "ON "
  957.   elseif synStateColor31 == colors.red then
  958.     state31 = "OFF"
  959.   end
  960.   if synStateColor32 == colors.lime then
  961.     state32 = "ON "
  962.   elseif synStateColor32 == colors.red then
  963.     state32 = "OFF"
  964.   end
  965. end
  966.  
  967. function writeSyn1()
  968.   mon.clear()
  969.   term.redirect(mon)
  970.     paintutils.drawFilledBox(1, 1, 71, 35, colors.black)
  971.     paintutils.drawBox(2, 2, 54, 36, colors.lightGray)
  972.     paintutils.drawLine(28, 3, 28, 36, colors.lightGray)
  973.     paintutils.drawPixel(56, 66, colors.red)
  974.     paintutils.drawPixel(26, StartY,      synStateColor1)
  975.     paintutils.drawPixel(26, StartY + 2,  synStateColor2)
  976.     paintutils.drawPixel(26, StartY + 4,  synStateColor3)
  977.     paintutils.drawPixel(26, StartY + 6,  synStateColor4)
  978.     paintutils.drawPixel(26, StartY + 8,  synStateColor5)
  979.     paintutils.drawPixel(26, StartY + 10, synStateColor6)
  980.     paintutils.drawPixel(26, StartY + 12, synStateColor7)
  981.     paintutils.drawPixel(26, StartY + 14, synStateColor8)
  982.     paintutils.drawPixel(26, StartY + 16, synStateColor9)
  983.     paintutils.drawPixel(26, StartY + 18, synStateColor10)
  984.     paintutils.drawPixel(26, StartY + 20, synStateColor11)
  985.     paintutils.drawPixel(26, StartY + 22, synStateColor12)
  986.     paintutils.drawPixel(26, StartY + 24, synStateColor13)
  987.     paintutils.drawPixel(26, StartY + 26, synStateColor14)
  988.     paintutils.drawPixel(26, StartY + 28, synStateColor15)
  989.     paintutils.drawPixel(26, StartY + 30, synStateColor16)
  990.     paintutils.drawPixel(52, StartY,      synStateColor17)
  991.     paintutils.drawPixel(52, StartY + 2,  synStateColor18)
  992.     paintutils.drawPixel(52, StartY + 4,  synStateColor19)
  993.     paintutils.drawPixel(52, StartY + 6,  synStateColor20)
  994.     paintutils.drawPixel(52, StartY + 8,  synStateColor21)
  995.     paintutils.drawPixel(52, StartY + 10, synStateColor22)
  996.     paintutils.drawPixel(52, StartY + 12, synStateColor23)
  997.     paintutils.drawPixel(52, StartY + 14, synStateColor24)
  998.     paintutils.drawPixel(52, StartY + 16, synStateColor25)
  999.     paintutils.drawPixel(52, StartY + 18, synStateColor26)
  1000.     paintutils.drawPixel(52, StartY + 20, synStateColor27)
  1001.     paintutils.drawPixel(52, StartY + 22, synStateColor28)
  1002.     paintutils.drawPixel(52, StartY + 24, synStateColor29)
  1003.     paintutils.drawPixel(52, StartY + 26, synStateColor30)
  1004.     paintutils.drawPixel(52, StartY + 28, synStateColor31)
  1005.     paintutils.drawPixel(52, StartY + 30, synStateColor32)
  1006.     paintutils.drawPixel(71, 35, colors.black)
  1007.     writeSyn2()
  1008. end
  1009. function writeSyn2()
  1010.   mon.setCursorPos(4,StartY)
  1011.   mon.write("Iron Golem:")
  1012.   mon.setCursorPos(StartX + 10,StartY)
  1013.   mon.write("OFF")
  1014.   mon.setCursorPos(StartX + 10,StartY)
  1015.   mon.write(state1)
  1016.   mon.setCursorPos(4,StartY + 2)
  1017.   mon.write("Wither Skeleton:")
  1018.   mon.setCursorPos(StartX + 10,StartY + 2)
  1019.   mon.write("OFF")
  1020.   mon.setCursorPos(StartX + 10,StartY + 2)
  1021.   mon.write(state2)
  1022.   mon.setCursorPos(4,StartY + 4)
  1023.   mon.write("Blaze:")
  1024.   mon.setCursorPos(StartX + 10,StartY + 4)
  1025.   mon.write("OFF")
  1026.   mon.setCursorPos(StartX + 10,StartY + 4)
  1027.   mon.write(state3)
  1028.   mon.setCursorPos(4,StartY + 6)
  1029.   mon.write("Zombie Pigman:")
  1030.   mon.setCursorPos(StartX + 10,StartY + 6)
  1031.   mon.write("OFF")
  1032.   mon.setCursorPos(StartX + 10,StartY + 6)
  1033.   mon.write(state4)
  1034.   mon.setCursorPos(4,StartY + 8)
  1035.   mon.write("Enderman:")
  1036.   mon.setCursorPos(StartX + 10,StartY + 8)
  1037.   mon.write("OFF")
  1038.   mon.setCursorPos(StartX + 10,StartY + 8)
  1039.   mon.write(state5)
  1040.   mon.setCursorPos(4,StartY + 10)
  1041.   mon.write("Ghast:")
  1042.   mon.setCursorPos(StartX + 10,StartY + 10)
  1043.   mon.write("OFF")
  1044.   mon.setCursorPos(StartX + 10,StartY + 10)
  1045.   mon.write(state6)
  1046.   mon.setCursorPos(4,StartY + 12)
  1047.   mon.write("Witch:")
  1048.   mon.setCursorPos(StartX + 10,StartY + 12)
  1049.   mon.write("OFF")
  1050.   mon.setCursorPos(StartX + 10,StartY + 12)
  1051.   mon.write(state7)
  1052.   mon.setCursorPos(4,StartY + 14)
  1053.   mon.write("Spider:")
  1054.   mon.setCursorPos(StartX + 10,StartY + 14)
  1055.   mon.write("OFF")
  1056.   mon.setCursorPos(StartX + 10,StartY + 14)
  1057.   mon.write(state8)
  1058.   mon.setCursorPos(4,StartY + 16)
  1059.   mon.write("Mooshroom:")  
  1060.   mon.setCursorPos(StartX + 10,StartY + 16)
  1061.   mon.write("OFF")
  1062.   mon.setCursorPos(StartX + 10,StartY + 16)
  1063.   mon.write(state9)
  1064.   mon.setCursorPos(4,StartY + 18)
  1065.   mon.write("Creeper:")  
  1066.   mon.setCursorPos(StartX + 10,StartY + 18)
  1067.   mon.write("OFF")
  1068.   mon.setCursorPos(StartX + 10,StartY + 18)
  1069.   mon.write(state10)
  1070.   mon.setCursorPos(4,StartY + 20)
  1071.   mon.write("Pech:")  
  1072.   mon.setCursorPos(StartX + 10,StartY + 20)
  1073.   mon.write("OFF")
  1074.   mon.setCursorPos(StartX + 10,StartY + 20)
  1075.   mon.write(state11)
  1076.   mon.setCursorPos(4,StartY + 22)
  1077.   mon.write("Crimson Cleric:")  
  1078.   mon.setCursorPos(StartX + 10,StartY + 22)
  1079.   mon.write("OFF")
  1080.   mon.setCursorPos(StartX + 10,StartY + 22)
  1081.   mon.write(state12)
  1082.   mon.setCursorPos(4,StartY + 24)
  1083.   mon.write("Crimson Knight:")  
  1084.   mon.setCursorPos(StartX + 10,StartY + 24)
  1085.   mon.write("OFF")
  1086.   mon.setCursorPos(StartX + 10,StartY + 24)
  1087.   mon.write(state13)
  1088.   mon.setCursorPos(4,StartY + 26)
  1089.   mon.write("Fire Elemental:")  
  1090.   mon.setCursorPos(StartX + 10,StartY + 26)
  1091.   mon.write("OFF")
  1092.   mon.setCursorPos(StartX + 10,StartY + 26)
  1093.   mon.write(state14)
  1094.   mon.setCursorPos(4,StartY + 28)
  1095.   mon.write("Wisp:")  
  1096.   mon.setCursorPos(StartX + 10,StartY + 28)
  1097.   mon.write("OFF")
  1098.   mon.setCursorPos(StartX + 10,StartY + 28)
  1099.   mon.write(state15)
  1100.   mon.setCursorPos(4,StartY + 30)
  1101.   mon.write("Pink Slime:")  
  1102.   mon.setCursorPos(StartX + 10,StartY + 30)
  1103.   mon.write("OFF")
  1104.   mon.setCursorPos(StartX + 10,StartY + 30)
  1105.   mon.write(state16)
  1106.   writeSyn3()
  1107. end
  1108. function writeSyn3()
  1109.   local StartX = 20
  1110.   mon.setCursorPos(30,StartY)
  1111.   mon.write("Spawner 17:")
  1112.   mon.setCursorPos(StartX + 28,StartY)
  1113.   mon.write("OFF")
  1114.   mon.setCursorPos(StartX + 28,StartY)
  1115.   mon.write(state17)
  1116.   mon.setCursorPos(30,StartY + 2)
  1117.   mon.write("Spawner 18:")
  1118.   mon.setCursorPos(StartX + 28,StartY + 2)
  1119.   mon.write("OFF")
  1120.   mon.setCursorPos(StartX + 28,StartY + 2)
  1121.   mon.write(state18)
  1122.   mon.setCursorPos(30,StartY + 4)
  1123.   mon.write("Spawner 19:")
  1124.   mon.setCursorPos(StartX + 28,StartY + 4)
  1125.   mon.write("OFF")
  1126.   mon.setCursorPos(StartX + 28,StartY + 4)
  1127.   mon.write(state19)
  1128.   mon.setCursorPos(30,StartY + 6)
  1129.   mon.write("Spawner 20:")
  1130.   mon.setCursorPos(StartX + 28,StartY + 6)
  1131.   mon.write("OFF")
  1132.   mon.setCursorPos(StartX + 28,StartY + 6)
  1133.   mon.write(state20)
  1134.   mon.setCursorPos(30,StartY + 8)
  1135.   mon.write("Spawner 21:")
  1136.   mon.setCursorPos(StartX + 28,StartY + 8)
  1137.   mon.write("OFF")
  1138.   mon.setCursorPos(StartX + 28,StartY + 8)
  1139.   mon.write(state21)
  1140.   mon.setCursorPos(30,StartY + 10)
  1141.   mon.write("Spawner 22:")
  1142.   mon.setCursorPos(StartX + 28,StartY + 10)
  1143.   mon.write("OFF")
  1144.   mon.setCursorPos(StartX + 28,StartY + 10)
  1145.   mon.write(state22)
  1146.   mon.setCursorPos(30,StartY + 12)
  1147.   mon.write("Spawner 23:")
  1148.   mon.setCursorPos(StartX + 28,StartY + 12)
  1149.   mon.write("OFF")
  1150.   mon.setCursorPos(StartX + 28,StartY + 12)
  1151.   mon.write(state23)
  1152.   mon.setCursorPos(30,StartY + 14)
  1153.   mon.write("Spawner 24:")
  1154.   mon.setCursorPos(StartX + 28,StartY + 14)
  1155.   mon.write("OFF")
  1156.   mon.setCursorPos(StartX + 28,StartY + 14)
  1157.   mon.write(state24)
  1158.   mon.setCursorPos(30,StartY + 16)
  1159.   mon.write("Spawner 25:")
  1160.   mon.setCursorPos(StartX + 28,StartY + 16)
  1161.   mon.write("OFF")
  1162.   mon.setCursorPos(StartX + 28,StartY + 16)
  1163.   mon.write(state25)
  1164.   mon.setCursorPos(30,StartY + 18)
  1165.   mon.write("Spawner 26:")
  1166.   mon.setCursorPos(StartX + 28,StartY + 18)
  1167.   mon.write("OFF")
  1168.   mon.setCursorPos(StartX + 28,StartY + 18)
  1169.   mon.write(state26)
  1170.   mon.setCursorPos(30,StartY + 20)
  1171.   mon.write("Spawner 27:")
  1172.   mon.setCursorPos(StartX + 28,StartY + 20)
  1173.   mon.write("OFF")
  1174.   mon.setCursorPos(StartX + 28,StartY + 20)
  1175.   mon.write(state27)
  1176.   mon.setCursorPos(30,StartY + 22)
  1177.   mon.write("Spawner 28:")
  1178.   mon.setCursorPos(StartX + 28,StartY + 22)
  1179.   mon.write("OFF")
  1180.   mon.setCursorPos(StartX + 28,StartY + 22)
  1181.   mon.write(state28)
  1182.   mon.setCursorPos(30,StartY + 24)
  1183.   mon.write("Spawner 29:")
  1184.   mon.setCursorPos(StartX + 28,StartY + 24)
  1185.   mon.write("OFF")
  1186.   mon.setCursorPos(StartX + 28,StartY + 24)
  1187.   mon.write(state29)
  1188.   mon.setCursorPos(30,StartY + 26)
  1189.   mon.write("Spawner 30:")
  1190.   mon.setCursorPos(StartX + 28,StartY + 26)
  1191.   mon.write("OFF")
  1192.   mon.setCursorPos(StartX + 28,StartY + 26)
  1193.   mon.write(state30)
  1194.   mon.setCursorPos(30,StartY + 28)
  1195.   mon.write("Spawner 31:")
  1196.   mon.setCursorPos(StartX + 28,StartY + 28)
  1197.   mon.write("OFF")
  1198.   mon.setCursorPos(StartX + 28,StartY + 28)
  1199.   mon.write(state31)
  1200.   mon.setCursorPos(30,StartY + 30)
  1201.   mon.write("Spawner 32:")
  1202.   mon.setCursorPos(StartX + 28,StartY + 30)
  1203.   mon.write("OFF")
  1204.   mon.setCursorPos(StartX + 28,StartY + 30)
  1205.   mon.write(state32)
  1206. end
  1207.  
  1208. function setState()
  1209.   rs.setBundledOutput("left", colors.combine(synColor1, synColor2, synColor3, synColor4, synColor5, synColor6, synColor7, synColor8, synColor9, synColor10, synColor11, synColor12, synColor13, synColor14, synColor15, synColor16))
  1210.   setState2()
  1211. end
  1212. function setState2()
  1213.   rs.setBundledOutput("right", colors.combine(synColor17, synColor18, synColor19, synColor20, synColor21, synColor22, synColor23, synColor24, synColor25, synColor26, synColor27, synColor28, synColor29, synColor30, synColor31, synColor32))
  1214. end
  1215.  
  1216. function writeSyn()
  1217.   checkState()
  1218.   setState()
  1219.   saveGame()
  1220.   writeSyn1()
  1221. end
  1222.  
  1223. loadSave()
  1224. setStateViaColor()
  1225. writeSyn()
  1226.  
  1227. while true do
  1228.   writeSyn()
  1229.   rednet.open("back")
  1230.   id,message = rednet.receive()
  1231.     if id == 215 and message == "Toggle1" and state1 == "OFF" then
  1232.       state1 = "ON "
  1233.       writeSyn()
  1234.     elseif id == 215 and message == "Toggle1" and state1 == "ON " then
  1235.       state1 = "OFF"
  1236.       writeSyn()
  1237.     elseif id == 215 and message == "Toggle2" and state2 == "OFF" then
  1238.       state2 = "ON "
  1239.       writeSyn()
  1240.     elseif id == 215 and message == "Toggle2" and state2 == "ON " then
  1241.       state2 = "OFF"
  1242.       writeSyn()
  1243.     elseif id == 215 and message == "Toggle3" and state3 == "OFF" then
  1244.       state3 = "ON "
  1245.       writeSyn()
  1246.     elseif id == 215 and message == "Toggle3" and state3 == "ON " then
  1247.       state3 = "OFF"
  1248.       writeSyn()
  1249.     elseif id == 215 and message == "Toggle4" and state4 == "OFF" then
  1250.       state4 = "ON "
  1251.       writeSyn()
  1252.     elseif id == 215 and message == "Toggle4" and state4 == "ON " then
  1253.       state4 = "OFF"
  1254.       writeSyn()
  1255.     elseif id == 215 and message == "Toggle5" and state5 == "OFF" then
  1256.       state5 = "ON "
  1257.       writeSyn()
  1258.     elseif id == 215 and message == "Toggle5" and state5 == "ON " then
  1259.       state5 = "OFF"
  1260.       writeSyn()
  1261.     elseif id == 215 and message == "Toggle6" and state6 == "OFF" then
  1262.       state6= "ON "
  1263.       writeSyn()
  1264.     elseif id == 215 and message == "Toggle6" and state6 == "ON " then
  1265.       state6 = "OFF"
  1266.       writeSyn()
  1267.     elseif id == 215 and message == "Toggle7" and state7 == "OFF" then
  1268.       state7 = "ON "
  1269.       writeSyn()
  1270.     elseif id == 215 and message == "Toggle7" and state7 == "ON " then
  1271.       state7 = "OFF"
  1272.       writeSyn()
  1273.     elseif id == 215 and message == "Toggle8" and state8 == "OFF" then
  1274.       state8 = "ON "
  1275.       writeSyn()
  1276.     elseif id == 215 and message == "Toggle8" and state8 == "ON " then
  1277.       state8 = "OFF"
  1278.       writeSyn()
  1279.     elseif id == 215 and message == "Toggle9" and state9 == "OFF" then
  1280.       state9 = "ON "
  1281.       writeSyn()
  1282.     elseif id == 215 and message == "Toggle9" and state9 == "ON " then
  1283.       state9 = "OFF"
  1284.       writeSyn()
  1285.     elseif id == 215 and message == "Toggle10" and state10 == "OFF" then
  1286.       state10 = "ON "
  1287.       writeSyn()
  1288.     elseif id == 215 and message == "Toggle10" and state10 == "ON " then
  1289.       state10 = "OFF"
  1290.       writeSyn()
  1291.     elseif id == 215 and message == "Toggle11" and state11 == "OFF" then
  1292.       state11 = "ON "
  1293.       writeSyn()
  1294.     elseif id == 215 and message == "Toggle11" and state11 == "ON " then
  1295.       state11 = "OFF"
  1296.       writeSyn()
  1297.     elseif id == 215 and message == "Toggle12" and state12 == "OFF" then
  1298.       state12 = "ON "
  1299.       writeSyn()
  1300.     elseif id == 215 and message == "Toggle12" and state12 == "ON " then
  1301.       state12 = "OFF"
  1302.       writeSyn()
  1303.     elseif id == 215 and message == "Toggle13" and state13 == "OFF" then
  1304.       state13 = "ON "
  1305.       writeSyn()
  1306.     elseif id == 215 and message == "Toggle13" and state13 == "ON " then
  1307.       state13 = "OFF"
  1308.       writeSyn()
  1309.     elseif id == 215 and message == "Toggle14" and state14 == "OFF" then
  1310.       state14 = "ON "
  1311.       writeSyn()
  1312.     elseif id == 215 and message == "Toggle14" and state14 == "ON " then
  1313.       state14 = "OFF"
  1314.       writeSyn()
  1315.     elseif id == 215 and message == "Toggle15" and state15 == "OFF" then
  1316.       state15 = "ON "
  1317.       writeSyn()
  1318.     elseif id == 215 and message == "Toggle15" and state15 == "ON " then
  1319.       state15 = "OFF"
  1320.       writeSyn()
  1321.     elseif id == 215 and message == "Toggle16" and state16 == "OFF" then
  1322.       state16 = "ON "
  1323.       writeSyn()
  1324.     elseif id == 215 and message == "Toggle16" and state16 == "ON " then
  1325.       state16 = "OFF"
  1326.       writeSyn()
  1327.     elseif id == 215 and message == "Toggle17" and state17 == "OFF" then
  1328.       state17 = "ON "
  1329.       writeSyn()
  1330.     elseif id == 215 and message == "Toggle17" and state17 == "ON " then
  1331.       state17 = "OFF"
  1332.       writeSyn()
  1333.     elseif id == 215 and message == "Toggle18" and state18 == "OFF" then
  1334.       state18 = "ON "
  1335.       writeSyn()
  1336.     elseif id == 215 and message == "Toggle18" and state18 == "ON " then
  1337.       state18 = "OFF"
  1338.       writeSyn()
  1339.     elseif id == 215 and message == "Toggle19" and state19 == "OFF" then
  1340.       state19 = "ON "
  1341.       writeSyn()
  1342.     elseif id == 215 and message == "Toggle19" and state19 == "ON " then
  1343.       state19 = "OFF"
  1344.       writeSyn()
  1345.     elseif id == 215 and message == "Toggle20" and state20 == "OFF" then
  1346.       state20 = "ON "
  1347.       writeSyn()
  1348.     elseif id == 215 and message == "Toggle20" and state20 == "ON " then
  1349.       state20 = "OFF"
  1350.       writeSyn()
  1351.     elseif id == 215 and message == "Toggle21" and state21 == "OFF" then
  1352.       state21 = "ON "
  1353.       writeSyn()
  1354.     elseif id == 215 and message == "Toggle21" and state21 == "ON " then
  1355.       state21 = "OFF"
  1356.       writeSyn()
  1357.     elseif id == 215 and message == "Toggle22" and state22 == "OFF" then
  1358.       state22 = "ON "
  1359.       writeSyn()
  1360.     elseif id == 215 and message == "Toggle22" and state22 == "ON " then
  1361.       state22 = "OFF"
  1362.       writeSyn()
  1363.     elseif id == 215 and message == "Toggle23" and state23 == "OFF" then
  1364.       state23 = "ON "
  1365.       writeSyn()
  1366.     elseif id == 215 and message == "Toggle23" and state23 == "ON " then
  1367.       state23 = "OFF"
  1368.       writeSyn()
  1369.     elseif id == 215 and message == "Toggle24" and state24 == "OFF" then
  1370.       state24 = "ON "
  1371.       writeSyn()
  1372.     elseif id == 215 and message == "Toggle24" and state24 == "ON " then
  1373.       state24 = "OFF"
  1374.       writeSyn()
  1375.     elseif id == 215 and message == "Toggle25" and state25 == "OFF" then
  1376.       state25 = "ON "
  1377.       writeSyn()
  1378.     elseif id == 215 and message == "Toggle25" and state25 == "ON " then
  1379.       state25 = "OFF"
  1380.       writeSyn()
  1381.     elseif id == 215 and message == "Toggle26" and state26 == "OFF" then
  1382.       state26 = "ON "
  1383.       writeSyn()
  1384.     elseif id == 215 and message == "Toggle26" and state26 == "ON " then
  1385.       state26 = "OFF"
  1386.       writeSyn()
  1387.     elseif id == 215 and message == "Toggle27" and state27== "OFF" then
  1388.       state27 = "ON "
  1389.       writeSyn()
  1390.     elseif id == 215 and message == "Toggle27" and state27 == "ON " then
  1391.       state27 = "OFF"
  1392.       writeSyn()
  1393.     elseif id == 215 and message == "Toggle28" and state28 == "OFF" then
  1394.       state28 = "ON "
  1395.       writeSyn()
  1396.     elseif id == 215 and message == "Toggle28" and state28 == "ON " then
  1397.       state28 = "OFF"
  1398.       writeSyn()
  1399.     elseif id == 215 and message == "Toggle29" and state29 == "OFF" then
  1400.       state29 = "ON "
  1401.       writeSyn()
  1402.     elseif id == 215 and message == "Toggle29" and state29 == "ON " then
  1403.       state29 = "OFF"
  1404.       writeSyn()
  1405.     elseif id == 215 and message == "Toggle30" and state30 == "OFF" then
  1406.       state30 = "ON "
  1407.       writeSyn()
  1408.     elseif id == 215 and message == "Toggle30" and state30 == "ON " then
  1409.       state30 = "OFF"
  1410.       writeSyn()
  1411.     elseif id == 215 and message == "Toggle31" and state31 == "OFF" then
  1412.       state31 = "ON "
  1413.       writeSyn()
  1414.     elseif id == 215 and message == "Toggle31" and state31 == "ON " then
  1415.       state31 = "OFF"
  1416.       writeSyn()
  1417.     elseif id == 215 and message == "Toggle32" and state32 == "OFF" then
  1418.       state32 = "ON "
  1419.       writeSyn()
  1420.     elseif id == 215 and message == "Toggle32" and state32 == "ON " then
  1421.       state32 = "OFF"
  1422.       writeSyn()
  1423.     elseif id == 215 and message == "Reset" then
  1424.       paintutils.drawFilledBox(1, 1, 99, 99, colors.black)
  1425.       shell.run("rm " .. "saves")
  1426.       shell.run("startup")
  1427.     elseif id == 216 and message == "Toggle1" and state1 == "OFF" then
  1428.       state1 = "ON "
  1429.       writeSyn()
  1430.     elseif id == 216 and message == "Toggle1" and state1 == "ON " then
  1431.       state1 = "OFF"
  1432.       writeSyn()
  1433.     elseif id == 216 and message == "Toggle2" and state2 == "OFF" then
  1434.       state2 = "ON "
  1435.       writeSyn()
  1436.     elseif id == 216 and message == "Toggle2" and state2 == "ON " then
  1437.       state2 = "OFF"
  1438.       writeSyn()
  1439.     elseif id == 216 and message == "Toggle3" and state3 == "OFF" then
  1440.       state3 = "ON "
  1441.       writeSyn()
  1442.     elseif id == 216 and message == "Toggle3" and state3 == "ON " then
  1443.       state3 = "OFF"
  1444.       writeSyn()
  1445.     elseif id == 216 and message == "Toggle4" and state4 == "OFF" then
  1446.       state4 = "ON "
  1447.       writeSyn()
  1448.     elseif id == 216 and message == "Toggle4" and state4 == "ON " then
  1449.       state4 = "OFF"
  1450.       writeSyn()
  1451.     elseif id == 216 and message == "Toggle5" and state5 == "OFF" then
  1452.       state5 = "ON "
  1453.       writeSyn()
  1454.     elseif id == 216 and message == "Toggle5" and state5 == "ON " then
  1455.       state5 = "OFF"
  1456.       writeSyn()
  1457.     elseif id == 216 and message == "Toggle6" and state6 == "OFF" then
  1458.       state6= "ON "
  1459.       writeSyn()
  1460.     elseif id == 216 and message == "Toggle6" and state6 == "ON " then
  1461.       state6 = "OFF"
  1462.       writeSyn()
  1463.     elseif id == 216 and message == "Toggle7" and state7 == "OFF" then
  1464.       state7 = "ON "
  1465.       writeSyn()
  1466.     elseif id == 216 and message == "Toggle7" and state7 == "ON " then
  1467.       state7 = "OFF"
  1468.       writeSyn()
  1469.     elseif id == 216 and message == "Toggle8" and state8 == "OFF" then
  1470.       state8 = "ON "
  1471.       writeSyn()
  1472.     elseif id == 216 and message == "Toggle8" and state8 == "ON " then
  1473.       state8 = "OFF"
  1474.       writeSyn()
  1475.     elseif id == 216 and message == "Toggle9" and state9 == "OFF" then
  1476.       state9 = "ON "
  1477.       writeSyn()
  1478.     elseif id == 216 and message == "Toggle9" and state9 == "ON " then
  1479.       state9 = "OFF"
  1480.       writeSyn()
  1481.     elseif id == 216 and message == "Toggle10" and state10 == "OFF" then
  1482.       state10 = "ON "
  1483.       writeSyn()
  1484.     elseif id == 216 and message == "Toggle10" and state10 == "ON " then
  1485.       state10 = "OFF"
  1486.       writeSyn()
  1487.     elseif id == 216 and message == "Toggle11" and state11 == "OFF" then
  1488.       state11 = "ON "
  1489.       writeSyn()
  1490.     elseif id == 216 and message == "Toggle11" and state11 == "ON " then
  1491.       state11 = "OFF"
  1492.       writeSyn()
  1493.     elseif id == 216 and message == "Toggle12" and state12 == "OFF" then
  1494.       state12 = "ON "
  1495.       writeSyn()
  1496.     elseif id == 216 and message == "Toggle12" and state12 == "ON " then
  1497.       state12 = "OFF"
  1498.       writeSyn()
  1499.     elseif id == 216 and message == "Toggle13" and state13 == "OFF" then
  1500.       state13 = "ON "
  1501.       writeSyn()
  1502.     elseif id == 216 and message == "Toggle13" and state13 == "ON " then
  1503.       state13 = "OFF"
  1504.       writeSyn()
  1505.     elseif id == 216 and message == "Toggle14" and state14 == "OFF" then
  1506.       state14 = "ON "
  1507.       writeSyn()
  1508.     elseif id == 216 and message == "Toggle14" and state14 == "ON " then
  1509.       state14 = "OFF"
  1510.       writeSyn()
  1511.     elseif id == 216 and message == "Toggle15" and state15 == "OFF" then
  1512.       state15 = "ON "
  1513.       writeSyn()
  1514.     elseif id == 216 and message == "Toggle15" and state15 == "ON " then
  1515.       state15 = "OFF"
  1516.       writeSyn()
  1517.     elseif id == 216 and message == "Toggle16" and state16 == "OFF" then
  1518.       state16 = "ON "
  1519.       writeSyn()
  1520.     elseif id == 216 and message == "Toggle16" and state16 == "ON " then
  1521.       state16 = "OFF"
  1522.       writeSyn()
  1523.     elseif id == 216 and message == "Toggle17" and state17 == "OFF" then
  1524.       state17 = "ON "
  1525.       writeSyn()
  1526.     elseif id == 216 and message == "Toggle17" and state17 == "ON " then
  1527.       state17 = "OFF"
  1528.       writeSyn()
  1529.     elseif id == 216 and message == "Toggle18" and state18 == "OFF" then
  1530.       state18 = "ON "
  1531.       writeSyn()
  1532.     elseif id == 216 and message == "Toggle18" and state18 == "ON " then
  1533.       state18 = "OFF"
  1534.       writeSyn()
  1535.     elseif id == 216 and message == "Toggle19" and state19 == "OFF" then
  1536.       state19 = "ON "
  1537.       writeSyn()
  1538.     elseif id == 216 and message == "Toggle19" and state19 == "ON " then
  1539.       state19 = "OFF"
  1540.       writeSyn()
  1541.     elseif id == 216 and message == "Toggle20" and state20 == "OFF" then
  1542.       state20 = "ON "
  1543.       writeSyn()
  1544.     elseif id == 216 and message == "Toggle20" and state20 == "ON " then
  1545.       state20 = "OFF"
  1546.       writeSyn()
  1547.     elseif id == 216 and message == "Toggle21" and state21 == "OFF" then
  1548.       state21 = "ON "
  1549.       writeSyn()
  1550.     elseif id == 216 and message == "Toggle21" and state21 == "ON " then
  1551.       state21 = "OFF"
  1552.       writeSyn()
  1553.     elseif id == 216 and message == "Toggle22" and state22 == "OFF" then
  1554.       state22 = "ON "
  1555.       writeSyn()
  1556.     elseif id == 216 and message == "Toggle22" and state22 == "ON " then
  1557.       state22 = "OFF"
  1558.       writeSyn()
  1559.     elseif id == 216 and message == "Toggle23" and state23 == "OFF" then
  1560.       state23 = "ON "
  1561.       writeSyn()
  1562.     elseif id == 216 and message == "Toggle23" and state23 == "ON " then
  1563.       state23 = "OFF"
  1564.       writeSyn()
  1565.     elseif id == 216 and message == "Toggle24" and state24 == "OFF" then
  1566.       state24 = "ON "
  1567.       writeSyn()
  1568.     elseif id == 216 and message == "Toggle24" and state24 == "ON " then
  1569.       state24 = "OFF"
  1570.       writeSyn()
  1571.     elseif id == 216 and message == "Toggle25" and state25 == "OFF" then
  1572.       state25 = "ON "
  1573.       writeSyn()
  1574.     elseif id == 216 and message == "Toggle25" and state25 == "ON " then
  1575.       state25 = "OFF"
  1576.       writeSyn()
  1577.     elseif id == 216 and message == "Toggle26" and state26 == "OFF" then
  1578.       state26 = "ON "
  1579.       writeSyn()
  1580.     elseif id == 216 and message == "Toggle26" and state26 == "ON " then
  1581.       state26 = "OFF"
  1582.       writeSyn()
  1583.     elseif id == 216 and message == "Toggle27" and state27== "OFF" then
  1584.       state27 = "ON "
  1585.       writeSyn()
  1586.     elseif id == 216 and message == "Toggle27" and state27 == "ON " then
  1587.       state27 = "OFF"
  1588.       writeSyn()
  1589.     elseif id == 216 and message == "Toggle28" and state28 == "OFF" then
  1590.       state28 = "ON "
  1591.       writeSyn()
  1592.     elseif id == 216 and message == "Toggle28" and state28 == "ON " then
  1593.       state28 = "OFF"
  1594.       writeSyn()
  1595.     elseif id == 216 and message == "Toggle29" and state29 == "OFF" then
  1596.       state29 = "ON "
  1597.       writeSyn()
  1598.     elseif id == 216 and message == "Toggle29" and state29 == "ON " then
  1599.       state29 = "OFF"
  1600.       writeSyn()
  1601.     elseif id == 216 and message == "Toggle30" and state30 == "OFF" then
  1602.       state30 = "ON "
  1603.       writeSyn()
  1604.     elseif id == 216 and message == "Toggle30" and state30 == "ON " then
  1605.       state30 = "OFF"
  1606.       writeSyn()
  1607.     elseif id == 216 and message == "Toggle31" and state31 == "OFF" then
  1608.       state31 = "ON "
  1609.       writeSyn()
  1610.     elseif id == 216 and message == "Toggle31" and state31 == "ON " then
  1611.       state31 = "OFF"
  1612.       writeSyn()
  1613.     elseif id == 216 and message == "Toggle32" and state32 == "OFF" then
  1614.       state32 = "ON "
  1615.       writeSyn()
  1616.     elseif id == 216 and message == "Toggle32" and state32 == "ON " then
  1617.       state32 = "OFF"
  1618.       writeSyn()
  1619.     elseif id == 216 and message == "Reset" then
  1620.       paintutils.drawFilledBox(1, 1, 99, 99, colors.black)
  1621.       shell.run("rm " .. "saves")
  1622.       shell.run("startup")
  1623.     else
  1624.       print("Error")
  1625.     end
  1626.   rednet.close("back")
  1627. end
Add Comment
Please, Sign In to add comment