MagmaLP

MonSell1

Jun 18th, 2021 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Manuell "log1" bis "log5" erstellen und
  2. -- "aus" reinschreiben.
  3. -- "edit log1" -> "aus" -> Speichern
  4.  
  5. output = "front"   -- Bundled Output Side
  6. side = "back"      -- Monitor Side
  7.  
  8. redstone.setBundledOutput(output, 0)
  9. mon = peripheral.wrap(side)
  10. mon.setTextScale(1.5)
  11. mon.setBackgroundColor(colors.black)
  12. mon.clear()
  13.  
  14. function msg(gap, line, color, groundb, text)
  15.     if color == 1 then
  16.         color = 1
  17.     elseif color == 02 then
  18.         color = 2
  19.     elseif color == 03 then
  20.         color = 4
  21.     elseif color == 04 then
  22.         color = 8
  23.     elseif color == 05 then
  24.         color = 16
  25.     elseif color == 06 then
  26.         color = 32
  27.     elseif color == 07 then
  28.         color = 64
  29.     elseif color == 08 then
  30.         color = 128
  31.     elseif color == 09 then
  32.         color = 256
  33.     elseif color == 10 then
  34.         color = 512
  35.     elseif color == 11 then
  36.         color = 1024
  37.     elseif color == 12 then
  38.         color = 2048
  39.     elseif color == 13 then
  40.         color = 4096
  41.     elseif color == 14 then
  42.         color = 8192
  43.     elseif color == 15 then
  44.         color = 16384
  45.     elseif color == 16 then
  46.         color = 32768
  47.     end
  48.     if groundb == 1 then
  49.         groundb = 1
  50.     elseif groundb == 02 then
  51.         groundb = 2
  52.     elseif groundb == 03 then
  53.         groundb = 4
  54.     elseif groundb == 04 then
  55.         groundb = 8
  56.     elseif groundb == 05 then
  57.         groundb = 16
  58.     elseif groundb == 06 then
  59.         groundb = 32
  60.     elseif groundb == 07 then
  61.         groundb = 64
  62.     elseif groundb == 08 then
  63.         groundb = 128
  64.     elseif groundb == 09 then
  65.         groundb = 256
  66.     elseif groundb == 10 then
  67.         groundb = 512
  68.     elseif groundb == 11 then
  69.         groundb = 1024
  70.     elseif groundb == 12 then
  71.         groundb = 2048
  72.     elseif groundb == 13 then
  73.         groundb = 4096
  74.     elseif groundb == 14 then
  75.         groundb = 8192
  76.     elseif groundb == 15 then
  77.         groundb = 16384
  78.     elseif groundb == 16 then
  79.         groundb = 32768
  80.     end
  81.  
  82.     mon.setBackgroundColor(groundb)
  83.     mon.setCursorPos(gap,line)
  84.     mon.setTextColor(color)
  85.     text = mon.write(text)
  86. end
  87.  
  88. ------------------------------------
  89. -- Diesen Abstand immer einhalten !!!
  90. --             "                 "
  91.  
  92. function Iaus()
  93.     msg(2,02,1,15,"                 ")
  94.     msg(2,03,1,15,"     Bsp. 1      ")
  95.     msg(2,04,1,15,"                 ")
  96. end
  97.  
  98. function IIaus()
  99.     msg(2,06,1,15,"                 ")
  100.     msg(2,07,1,15,"     Bsp. 2      ")
  101.     msg(2,08,1,15,"                 ")
  102. end
  103.  
  104. function IIIaus()
  105.     msg(2,10,1,15,"                 ")
  106.     msg(2,11,1,15,"     Bsp. 3      ")
  107.     msg(2,12,1,15,"                 ")
  108. end
  109.  
  110. function IVaus()
  111.     msg(2,14,1,15,"                 ")
  112.     msg(2,15,1,15,"     Bsp. 4      ")
  113.     msg(2,16,1,15,"                 ")
  114. end
  115.  
  116. function Vaus()
  117.     msg(2,18,1,15,"                 ")
  118.     msg(2,19,1,15,"     Bsp. 5      ")
  119.     msg(2,20,1,15,"                 ")
  120. end
  121.  
  122. ------------------------------------
  123. -- Diesen Abstand immer einhalten !!!
  124. --             "                 "
  125.  
  126. function Ian()
  127.     msg(2,02,1,06,"                 ")
  128.     msg(2,03,1,06,"     Bsp. 1      ")
  129.     msg(2,04,1,06,"                 ")
  130. end
  131.  
  132. function IIan()
  133.     msg(2,06,1,06,"                 ")
  134.     msg(2,07,1,06,"     Bsp. 2      ")
  135.     msg(2,08,1,06,"                 ")
  136. end
  137.  
  138. function IIIan()
  139.     msg(2,10,1,06,"                 ")
  140.     msg(2,11,1,06,"     Bsp. 3      ")
  141.     msg(2,12,1,06,"                 ")
  142. end
  143.  
  144. function IVan()
  145.     msg(2,14,1,06,"                 ")
  146.     msg(2,15,1,06,"     Bsp. 4      ")
  147.     msg(2,16,1,06,"                 ")
  148. end
  149.  
  150. function Van()
  151.     msg(2,18,1,06,"                 ")
  152.     msg(2,19,1,06,"     Bsp. 5      ")
  153.     msg(2,20,1,06,"                 ")
  154. end
  155. ------------------------------------
  156.  
  157.     file = fs.open("log1", "r")
  158.     local inhalt = file.readLine()
  159.     file.close()
  160.     print(inhalt)
  161.     if inhalt == "an" then
  162.         Ian()
  163.   sleep(0.5)
  164.         redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.yellow))
  165.         sleep(0.5)
  166.     elseif inhalt == "aus" then
  167.         Iaus()
  168.   sleep(0.5)
  169.         redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.yellow))
  170.         sleep(0.5)
  171.     end
  172.  
  173.     file = fs.open("log2", "r")
  174.     local inhalt = file.readLine()
  175.     file.close()
  176.     print(inhalt)
  177.     if inhalt == "an" then
  178.         IIan()
  179.         redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.blue))
  180.         sleep(0.5)
  181.     elseif inhalt == "aus" then
  182.         IIaus()
  183.         redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.blue))
  184.         sleep(0.5)
  185.     end
  186.  
  187.     file = fs.open("log3", "r")
  188.     local inhalt = file.readLine()
  189.     file.close()
  190.     print(inhalt)
  191.     if inhalt == "an" then
  192.         IIIan()
  193.         redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.white))
  194.         sleep(0.5)
  195.     elseif inhalt == "aus" then
  196.         IIIaus()
  197.         redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.white))
  198.         sleep(0.5)
  199.     end
  200.  
  201.     file = fs.open("log4", "r")
  202.     local inhalt = file.readLine()
  203.     file.close()
  204.     print(inhalt)
  205.     if inhalt == "an" then
  206.         IVan()
  207.         redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.red))
  208.         sleep(0.5)
  209.     elseif inhalt == "aus" then
  210.         IVaus()
  211.         redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.red))
  212.         sleep(0.5)
  213.     end
  214.  
  215.     file = fs.open("log5", "r")
  216.     local inhalt = file.readLine()
  217.     file.close()
  218.     print(inhalt)
  219.     if inhalt == "an" then
  220.         Van()
  221.         redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.green))
  222.         sleep(0.5)
  223.     elseif inhalt == "aus" then
  224.         Vaus()
  225.         redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.green))
  226.         sleep(0.5)
  227.     end
  228.  
  229.  
  230.  
  231. while true do
  232.         local event, side, X, Y = os.pullEvent("monitor_touch")
  233.         if X >= 1 and X <= 17 and Y >= 2 and Y <= 4 and side == side then
  234.             file = fs.open("log1", "r")
  235.             local inhalt = file.readLine()
  236.             file.close()
  237.             print(inhalt)
  238.             if inhalt == "an" then
  239.                 Iaus()
  240.                 file = fs.open("log1", "w")
  241.                 file.write("aus")
  242.                 file.close()
  243.                 redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.yellow))
  244.                 sleep(0.5)
  245.             elseif inhalt == "aus" then
  246.                 Ian()
  247.                 file = fs.open("log1", "w")
  248.                 file.write("an")
  249.                 file.close()
  250.                 redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.yellow))
  251.                 sleep(0.5)
  252.             end  
  253.         elseif X >= 1 and X <= 17 and Y >= 6 and Y <= 8 and side == side then
  254.             file = fs.open("log2", "r")
  255.             local inhalt = file.readLine()
  256.             file.close()
  257.             print(inhalt)
  258.             if inhalt == "an" then
  259.                 IIaus()
  260.                 file = fs.open("log2", "w")
  261.                 file.write("aus")
  262.                 file.close()
  263.                 redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.blue))
  264.                 sleep(0.5)
  265.             elseif inhalt == "aus" then
  266.                 IIan()
  267.                 file = fs.open("log2", "w")
  268.                 file.write("an")
  269.                 file.close()
  270.                 redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.blue))
  271.                 sleep(0.5)
  272.             end
  273.         elseif X >= 1 and X <= 17 and Y >= 10 and Y <= 12 and side == side then
  274.             file = fs.open("log3", "r")
  275.             local inhalt = file.readLine()
  276.             file.close()
  277.             print(inhalt)
  278.             if inhalt == "an" then
  279.                 IIIaus()
  280.                 file = fs.open("log3", "w")
  281.                 file.write("aus")
  282.                 file.close()
  283.                 redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.white))
  284.                 sleep(0.5)
  285.             elseif inhalt == "aus" then
  286.                 IIIan()
  287.                 file = fs.open("log3", "w")
  288.                 file.write("an")
  289.                 file.close()
  290.                 redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.white))
  291.                 sleep(0.5)
  292.             end
  293.         elseif X >= 1 and X <= 17 and Y >= 14 and Y <= 16 and side == side then
  294.             file = fs.open("log4", "r")
  295.             local inhalt = file.readLine()
  296.             file.close()
  297.             print(inhalt)
  298.             if inhalt == "an" then
  299.                 IVaus()
  300.                 file = fs.open("log4", "w")
  301.                 file.write("aus")
  302.                 file.close()
  303.                 redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.red))
  304.                 sleep(0.5)
  305.             elseif inhalt == "aus" then
  306.                 IVan()
  307.                 file = fs.open("log4", "w")
  308.                 file.write("an")
  309.                 file.close()
  310.                 redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.red))
  311.                 sleep(0.5)
  312.             end
  313.         elseif X >= 1 and X <= 17 and Y >= 18 and Y <= 20 and side == side then
  314.             file = fs.open("log5", "r")
  315.             local inhalt = file.readLine()
  316.             file.close()
  317.             print(inhalt)
  318.             if inhalt == "an" then
  319.                 Vaus()
  320.                 file = fs.open("log5", "w")
  321.                 file.write("aus")
  322.                 file.close()
  323.                 redstone.setBundledOutput(output,colors.subtract(redstone.getBundledOutput(output), colors.green))
  324.                 sleep(0.5)
  325.             elseif inhalt == "aus" then
  326.                 Van()
  327.                 file = fs.open("log5", "w")
  328.                 file.write("an")
  329.                 file.close()
  330.                 redstone.setBundledOutput(output,colors.combine(redstone.getBundledOutput(output), colors.green))
  331.                 sleep(0.5)
  332.             end
  333.         end
  334. sleep(0.5)
  335. end
Add Comment
Please, Sign In to add comment