Advertisement
bobmarley12345

reghzyosthingidek

Sep 6th, 2021 (edited)
1,425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.19 KB | None | 0 0
  1. function string.jsub(str, startIndex, endIndex)
  2.     if (endIndex == nil) then
  3.         endIndex = string.len(str) + 1
  4.     end
  5.    
  6.     return string.sub(str, startIndex, endIndex - 1)
  7. end
  8.  
  9. -- Checks if the given `str` starts with the given `value` (optionally start searching with the given start offset index. 1 by default). `string.startsWith("hello", "he", 1)` == `true`
  10. function string.startsWith(str, value, startIndex)
  11.     if (startIndex == nil) then
  12.         startIndex = 1
  13.     end
  14.    
  15.     return string.jsub(str, startIndex, string.len(value) + startIndex) == value
  16. end
  17.  
  18. -- Checks if the given `str` ends with the given value. string.endsWith("hello", "lo") == true
  19. function string.endsWith(str, value)
  20.     local strLen = string.len(str)
  21.     local valLen = string.len(value)
  22.     return string.sub(str, strLen - valLen + 1, strLen) == value
  23. end
  24.  
  25. function string.contains(str, value, startIndex)
  26.     if (startIndex == nil) then
  27.         startIndex = 1
  28.     end
  29.    
  30.     return string.find(str, value) ~= nil
  31. end
  32.  
  33. function string.indexOf(str, value, startIndex)
  34.     if (startIndex == nil) then
  35.         startIndex = 1
  36.     end
  37.  
  38.     local s,e,c = string.find(str, value)
  39.     if (s == nil) then
  40.         return -1
  41.     end
  42.  
  43.     return s
  44. end
  45.  
  46. -- Clamps the given string to the given length. `string.len(str)` is smaller than or equal to `maxLen` then `str` is returned. Otherwise, a substring of `maxLen - 3` of characters + `"..."` is returned  
  47. function string.clampString(str, maxLen)
  48.     local strLen = string.len(str)
  49.     if (strLen <= maxLen) then
  50.         return str
  51.     end
  52.  
  53.     return (string.sub(str, 1, maxLen - 3) .. "...")
  54. end
  55.  
  56. utils = { }
  57.  
  58. -- Calculates the center Y coordinate between `start` (inclusive) and `end` (inclusive)
  59. function utils.centerOf(start, ending)
  60.     if (start == ending) then
  61.         return start
  62.     elseif (start < ending) then
  63.         return math.floor((ending - start) / 2)
  64.     else
  65.         return math.floor((start - ending) / 2)
  66.     end
  67. end
  68.  
  69. function utils.thatOrNull(nullable, nonNull)
  70.     if (nullable == nil) then
  71.         return nonNull
  72.     end
  73.  
  74.     return nullable
  75. end
  76.  
  77. function utils.byteToMegaByte(bytes)
  78.     return bytes / 1048576
  79. end
  80.  
  81. function utils.byteToKiloByte(bytes)
  82.     return bytes / 1024
  83. end
  84.  
  85. function utils.byteToGigaByte(bytes)
  86.     return bytes / 1073741824
  87. end
  88.  
  89. GDI = {
  90.     Handle = { }
  91. }
  92.  
  93. -- returns a non null text colour
  94. function GDI.nonNullTextColour(text_colour)
  95.     if (text_colour == nil) then
  96.         return colours.white
  97.     end
  98.  
  99.     return text_colour
  100. end
  101.  
  102. -- returns a non null background colour
  103. function GDI.nonNullBackgroundColour(background_colour)
  104.     if (background_colour == nil) then
  105.         return colours.black
  106.     end
  107.  
  108.     return background_colour
  109. end
  110.  
  111. -- sets the monitor cursor pos
  112. function GDI.cpos(x, y)
  113.     GDI.Handle.setCursorPos(x, y)
  114. end
  115.  
  116. -- sets the monitor text colour
  117. function GDI.textColour(colour)
  118.     GDI.Handle.setTextColor(colour)
  119. end
  120.  
  121. -- sets the monitor background colour
  122. function GDI.backgroundColour(colour)
  123.     GDI.Handle.setBackgroundColor(colour)
  124. end
  125.  
  126. function GDI.clearBackground(foreground, background)
  127.     GDI.textColour(GDI.nonNullTextColour(foreground))
  128.     GDI.backgroundColour(GDI.nonNullBackgroundColour(background))
  129.     GDI.Handle.clear()
  130. end
  131.  
  132. -- draws text on the monitor
  133. function GDI.drawText(x, y, text, foreground, background)
  134.     GDI.textColour(GDI.nonNullTextColour(foreground))
  135.     GDI.backgroundColour(GDI.nonNullBackgroundColour(background))
  136.     GDI.cpos(x, y)
  137.     local txt = tostring(text)
  138.     GDI.Handle.write(txt)
  139.     return string.len(txt)
  140. end
  141.  
  142. function GDI.drawLineH(x, y, w, background)
  143.     GDI.drawText(x, y, string.rep(" ", w), background, background)
  144. end
  145.  
  146. function GDI.drawLineV(x, y, h, background)
  147.     GDI.textColour(GDI.nonNullTextColour(background))
  148.     GDI.backgroundColour(GDI.nonNullBackgroundColour(background))
  149.     for i = y, h do
  150.         GDI.Handle.write(" ")
  151.         GDI.cpos(x, i)
  152.     end
  153. end
  154.  
  155. function GDI.drawSquare(x, y, w, h, background)
  156.     local line = y
  157.     local endLine = y + h
  158.     while (true) do
  159.         GDI.drawLineH(x, line, w, background)
  160.         line = line + 1
  161.         if (line >= endLine) then
  162.             return
  163.         end
  164.     end
  165. end
  166.  
  167. function GDI.drawProgressBar(x, y, w, h, min, max, val, foreground, background)
  168.     GDI.drawSquare(x, y, w, h, background)
  169.     GDI.drawSquare(x, y, math.floor((val / (max - min)) * w), h, foreground)
  170. end
  171.  
  172. -- hello   5
  173. -- helo-   4
  174. -- -hie-   3
  175. -- -hi--   2
  176. -- - h -   1
  177.  
  178. -- - h --   1
  179.  
  180. -- - hh --   2
  181. -- -- h --   1
  182.  
  183. function GDI.drawGroupBoxHeader(x, y, w, text, foreground, background)
  184.     local strLen = string.len(text)
  185.     if (strLen >= w) then
  186.         GDI.drawText(x, y, string.sub(text, 1, w), foreground, background)
  187.     elseif (strLen == (w - 1)) then
  188.         GDI.drawText(x, y, text .. "-", foreground, background)
  189.     elseif (strLen == (w - 2)) then
  190.         GDI.drawText(x, y, "-" .. text .. "-", foreground, background)
  191.     elseif (strLen == (w - 3)) then
  192.         GDI.drawText(x, y, "-" .. text .. " -", foreground, background)
  193.     else
  194.         local leftOverSpace = strLen - w
  195.         local halfLeftOver = leftOverSpace / 2
  196.         if (leftOverSpace % 2 == 0) then -- even
  197.             local glyphText = string.rep("-", halfLeftOver - 1)
  198.             GDI.drawText(x, y, glyphText .. " " .. text .. " " .. glyphText)
  199.         else -- odd
  200.             local glyphTextA = string.rep("-", math.floor(halfLeftOver - 1))
  201.             local glyphTextB = string.rep("-", math.ceil(halfLeftOver - 1))
  202.             GDI.drawText(x, y, glyphTextA .. " " .. text .. " " .. glyphTextB)
  203.         end
  204.     end  
  205. end
  206.  
  207. function GDI.drawGroupBoxWall(x, y, h, foreground, background)
  208.     GDI.textColour(GDI.nonNullTextColour(foreground))
  209.     GDI.backgroundColour(GDI.nonNullBackgroundColour(background))
  210.     for i = y, h do
  211.         GDI.Handle.write("-")
  212.         GDI.cpos(x, i)
  213.     end
  214. end
  215.  
  216. function GDI.drawGroupBoxFooter(x, y, w, foreground, background)
  217.     GDI.drawText(x, y, string.rep("-", w), foreground, background)
  218. end
  219.  
  220. function GDI.drawGroupBox(x, y, w, h, header, border_foreground, border_background, background)
  221.     GDI.drawSquare(x, y, w, h, background)
  222.     GDI.drawGroupBoxHeader(x, y, w, header, border_foreground, border_background)
  223.     GDI.drawGroupBoxWall(x, y, h, border_foreground, border_background)
  224.     GDI.drawGroupBoxWall(x + w, y, h, border_foreground, border_background)
  225.     GDI.drawGroupBoxFooter(x, y + h, w, border_foreground, border_background)
  226. end
  227.  
  228. function GDI.drawWindowTitle(x, y, w, title, foreground, background)
  229.     if (background == nil) then
  230.         background = colours.grey
  231.     end
  232.     local len = GDI.drawText(x, y, string.clampString(title, w - 5), foreground, background)
  233.     local endX = x + w
  234.     GDI.drawLineH(x + len, y, w - len - 4, background)
  235.     GDI.drawText(endX - 4, y, "-", colours.foreground, colours.lightGrey)
  236.     GDI.drawText(endX - 3, y, "[]", colours.foreground, colours.lightGrey)
  237.     GDI.drawText(endX - 1, y, "x", colours.foreground, colours.red)
  238. end
  239.  
  240. function GDI.drawWindow(x, y, w, h, title, titleForeground, titleBackground, background)
  241.     GDI.drawSquare(x, y, w, h, utils.thatOrNull(background, colours.white))
  242.     GDI.drawWindowTitle(x, y, w, title, utils.thatOrNull(titleForeground, colours.lightGrey), utils.thatOrNull(titleBackground, colours.grey))
  243. end
  244.  
  245. function GDI.clearMonitor()
  246.     GDI.textColour(colours.white)
  247.     GDI.backgroundColour(colours.black)
  248.     GDI.Handle.clear()
  249. end
  250.  
  251. totalMinEnergy = 0
  252. totalMaxEnergy = 0
  253. totalStoredEnergy = 0
  254. biggestId = 0
  255. peripherals = { }
  256. line = 1
  257.  
  258. function getTypeAndId(name)
  259.     local nameIndex = string.indexOf(name, "_name")
  260.     if (nameIndex == -1) then
  261.         return nil
  262.     end
  263.  
  264.     local machineId = tonumber(string.sub(name, nameIndex + 5))
  265.     if (machineId == nil) then
  266.         return nil
  267.     end
  268.  
  269.     return string.sub(name, 31, nameIndex - 1), machineId
  270. end
  271.  
  272. Monitors = {
  273.     Peripherals = {
  274.        
  275.     },
  276.     Information = {
  277.         Setup = function (me)
  278.             -- local w,h = me.Handle.getSize()
  279.             -- me.Width = w
  280.             -- me.Height = h
  281.             -- 25
  282.             me.Handle.setTextScale(1)
  283.  
  284.             -- tile_thermalexpansion_machine_pulverizer_name_<number>  = pulverizer
  285.             -- tile_thermalexpansion_machine_smelter_name_<number>     = induction
  286.             -- tile_thermalexpansion_machine_furnace_name_<number>     = furnace
  287.  
  288.             for i, name in pairs(peripheral.getNames()) do
  289.                 if (name ~= nil) then
  290.                     if (string.startsWith(name, "tile_thermalexpansion_machine_", 1)) then
  291.                         local name, id = getTypeAndId(name)
  292.                         if (name ~= nil and id ~= nil) then
  293.                             local cellHandle = peripheral.wrap(name)
  294.                             me.Peripherals[id] = {
  295.                                 Handle = cellHandle,
  296.                                 DeviceFullName = name,
  297.                                 DeviceMinEnergy = 0,
  298.                                 DeviceMaxEnergy = 0,
  299.                                 DeviceEnergyStored = 0,
  300.                                 CellID = id
  301.                             }
  302.                         end
  303.                     end
  304.                 end
  305.             end
  306.  
  307.         end,
  308.         Handle = peripheral.wrap("monitor_51"),
  309.         Width = 82,
  310.         Height = 33,
  311.         IsInteractive = true,
  312.         Update = function (me)
  313.  
  314.         end,
  315.         Draw = function (me)
  316.  
  317.         end
  318.     },
  319.     PlayerInfo = {
  320.         Setup = function (me)
  321.         end,
  322.         Handle = peripheral.wrap("monitor_56"),
  323.         Width = 18,
  324.         Height = 33,
  325.         IsInteractive = false,
  326.         Update = function (me)
  327.            
  328.         end,
  329.         Draw = function (me)
  330.  
  331.         end
  332.     },
  333.     PowerInfo = {
  334.         Setup = function (me)
  335.             GDI.drawSquare(1, 1, 7, me.Height, colours.grey)
  336.             GDI.drawSquare(1, me.Height - 3, me.Width, 4, colours.grey)
  337.         end,
  338.         Handle = peripheral.wrap("monitor_53"),
  339.         Width = 29,
  340.         Height = 40,
  341.         IsInteractive = false,
  342.         StartMaxIdLen = 1,
  343.         TotalCellMin = 0,
  344.         TotalCellMax = 0,
  345.         TotalCellStored = 0,
  346.         Cells = {
  347.             Cell1 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_0"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell1.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell1.Handle.getEnergyStored("UNKNOWN") end },
  348.             Cell2 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_1"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell2.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell2.Handle.getEnergyStored("UNKNOWN") end },
  349.             Cell3 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_2"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell3.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell3.Handle.getEnergyStored("UNKNOWN") end },
  350.             Cell4 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_3"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell4.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell4.Handle.getEnergyStored("UNKNOWN") end },
  351.             Cell5 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_4"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell5.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell5.Handle.getEnergyStored("UNKNOWN") end },
  352.             Cell6 = { Handle = peripheral.wrap("cofh_thermalexpansion_energycell_5"), Min = function() return 0 end, Max = function () return Monitors.PowerInfo.Cells.Cell6.Handle.getMaxEnergyStored("UNKNOWN") end, Stored = function () return Monitors.PowerInfo.Cells.Cell6.Handle.getEnergyStored("UNKNOWN") end }
  353.         },
  354.         LineIndex = 1,
  355.         Update = function (me)
  356.  
  357.         end,
  358.         Draw = function (me)
  359.             local line = 2
  360.             for k,v in pairs(me.Cells) do
  361.                 me.LocalFunctions.drawEnergyCell(me, line, v, tostring(k))
  362.                 line = line + 2
  363.             end
  364.             GDI.drawText(2, me.Height - 2, "Total energy", colours.white, colours.grey)
  365.             GDI.drawProgressBar(2, me.Height - 1, me.Width - 2, 1, me.TotalCellMin, me.TotalCellMax, me.TotalCellStored, colours.cyan, colours.grey)
  366.         end,
  367.         LocalFunctions = {
  368.             drawEnergyCell = function (me, y, cell, name)
  369.                 GDI.drawText(2, y, name, colours.white, colours.grey)
  370.                 local startX = string.len(name) + 4
  371.                 local min  = cell.Min()
  372.                 local max  = cell.Max()
  373.                 local val  = cell.Stored()
  374.                 me.TotalCellMin = me.TotalCellMin + min
  375.                 me.TotalCellMax = me.TotalCellMax + max
  376.                 me.TotalCellStored = me.TotalCellStored + val
  377.                 GDI.drawProgressBar(startX, y, me.Width - startX, 1, min, max, val, colours.cyan, colours.grey)
  378.             end
  379.         }
  380.     },
  381.     InteractiveMain = {
  382.         Setup = function (me)
  383.             GDI.drawSquare(4, 15, 35, 11, colours.white)
  384.             me.LoadCells()
  385.         end,
  386.         LoadCells = function()
  387.             for i, name in pairs(peripheral.getNames()) do
  388.                 if (string.startsWith(name, "cofh_thermalexpansion_energycell_", 1)) then
  389.                     local cellId = tonumber(string.sub(tostring(name), 34))
  390.                     if (cellId ~= nil) then
  391.                         if (cellId > biggestId) then
  392.                             biggestId = cellId
  393.                         end
  394.                         local cellHandle = peripheral.wrap(name)
  395.                         peripherals[cellId] = {
  396.                             Handle = cellHandle,
  397.                             full_name = name,
  398.                             minEnergy = 0,
  399.                             maxEnergy = 0,
  400.                             stored = 0,
  401.                             id = cellId,
  402.                             update = function (cell_id)
  403.                                 local cell = peripherals[cell_id]
  404.                                 if (cell.Handle ~= nil) then
  405.                                     cell.minEnergy = 0
  406.                                     cell.maxEnergy = cell.Handle.getMaxEnergyStored("UNKNOWN")
  407.                                     cell.stored = cell.Handle.getEnergyStored("UNKNOWN")
  408.                                 end
  409.                             end
  410.                         }
  411.                     end
  412.                 end
  413.             end
  414.         end,
  415.         LineNumber = 1,
  416.         DrawCell = function (me, x, y, w, h, name, cell)
  417.             local offset = string.len(tostring(biggestId))
  418.             local startX = x + offset
  419.             GDI.drawText(x + 1, y, name, colours.black, colours.white)
  420.             GDI.drawProgressBar(startX + 3, y, w - offset - 4, 1, cell.minEnergy, cell.maxEnergy, cell.stored, colours.cyan, colours.lightGrey)
  421.         end,
  422.         TotalCellCount = 0,
  423.         StaticCellCount = 0,
  424.         Handle = peripheral.wrap("monitor_54"),
  425.         Width = 71,
  426.         Height = 26,
  427.         IsInteractive = true,
  428.         MESystem = {
  429.             Handle = peripheral.wrap("appeng_me_tilecontroller_1"),
  430.             GetTotalBytes = function () return Monitors.InteractiveMain.MESystem.Handle.getTotalBytes() end,
  431.             GetFreeBytes = function () return Monitors.InteractiveMain.MESystem.Handle.getFreeBytes() end,
  432.             GetUsedBytes = function () return Monitors.InteractiveMain.MESystem.Handle.getTotalBytes() - Monitors.InteractiveMain.MESystem.Handle.getFreeBytes() end
  433.         },
  434.         Update = function (me)
  435.             TotalCellCount = 0
  436.             for k,v in pairs(peripherals) do
  437.                 v.update(k)
  438.                 TotalCellCount = TotalCellCount + 1
  439.             end
  440.  
  441.             if (me.StaticCellCount ~= me.TotalCellCount) then
  442.                 me.StaticCellCount = me.TotalCellCount
  443.                 me.Draw(me)
  444.             end
  445.         end,
  446.         Draw = function (me)
  447.             GDI.drawWindowTitle(4, 15, 35, "ME System Storage Monitor", colours.lightGrey, colours.grey)
  448.             me.LocalFunctions.DrawMEPowerMon(me, 4, 16, 35, 11)
  449.             local h = (TotalCellCount * 2) + 2
  450.             GDI.drawWindow(40, 3, 24, h, "dynamic cells")
  451.             local line = 2
  452.             for k,v in pairs(peripherals) do
  453.                 me.DrawCell(me, 40, line + 3, 24, h, k, v)
  454.                 line = line + 2
  455.             end
  456.         end,
  457.         LocalFunctions = {
  458.             DrawMEPowerMon = function (me, x, y, w, h)
  459.                 local bytesTotal = me.MESystem.GetTotalBytes()
  460.                 local bytesFree = me.MESystem.GetFreeBytes()
  461.                 local bytesUsed = bytesTotal - bytesFree
  462.                 GDI.drawText(x + 1, y + 1, "Total Bytes", colours.black, colours.white)
  463.                 GDI.drawText(x + 1, y + 2, utils.byteToMegaByte(bytesTotal) .. " MB", colours.black, colours.white)
  464.                 GDI.drawText(x + 1, y + 4, "Free Bytes", colours.black, colours.white)
  465.                 GDI.drawText(x + 1, y + 5, utils.byteToMegaByte(bytesFree) .. " MB", colours.black, colours.white)
  466.                 GDI.drawText(x + 1, y + 7, "Bytes in Use", colours.black, colours.white)
  467.                 GDI.drawProgressBar(x + 1, y + 8, w - 2, 1, 0, bytesTotal, bytesUsed, colours.green, colours.grey)
  468.             end
  469.         }
  470.     },
  471.     NewsBoard = {
  472.         Setup = function (me)
  473.             local strLen = string.len(me.Text)
  474.             me.StartOffset = 1 - strLen
  475.             me.EndOffset = strLen
  476.         end,
  477.         Handle = peripheral.wrap("monitor_55"),
  478.         Width = 71,
  479.         Height = 5,
  480.         Text = "ello ello ello this is the police",
  481.         Offset = 1,
  482.         StartOffset = 1,
  483.         EndOffset = 1,
  484.         IsInteractive = false,
  485.         Update = function (me)
  486.             if (me.Offset >= me.EndOffset) then
  487.                 me.Offset = me.StartOffset
  488.             else
  489.                 me.Offset = me.Offset + 1
  490.             end
  491.         end,
  492.         Draw = function (me)
  493.             GDI.clearMonitor()
  494.             GDI.drawText(me.Offset, 3, me.Text, colours.white, colours.grey)
  495.         end
  496.     }
  497. }
  498.  
  499. function loadMonitor(mon)
  500.     GDI.Handle = mon.Handle
  501. end
  502.  
  503. function ProcessMonitor(mon)
  504.     loadMonitor(mon)
  505.     mon.Update(mon)
  506.     mon.Draw(mon)
  507. end
  508.  
  509. function ClearMonitor()
  510.     GDI.backgroundColour(GDI.nonNullBackgroundColour(nil))
  511.     GDI.textColour(GDI.nonNullTextColour(nil))
  512.     GDI.Handle.clear()
  513. end
  514.  
  515. function tryExec(func)
  516.     pcall(func)
  517. end
  518.  
  519. function UpdateMonitors()
  520.     ProcessMonitor(Monitors.Information)
  521.     ProcessMonitor(Monitors.InteractiveMain)
  522.     ProcessMonitor(Monitors.NewsBoard)
  523.     ProcessMonitor(Monitors.PlayerInfo)
  524.     ProcessMonitor(Monitors.PowerInfo)
  525. end
  526.  
  527. function main()
  528.     loadMonitor(Monitors.Information)
  529.     ClearMonitor()
  530.     loadMonitor(Monitors.InteractiveMain)
  531.     ClearMonitor()
  532.     loadMonitor(Monitors.NewsBoard)
  533.     ClearMonitor()
  534.     loadMonitor(Monitors.PlayerInfo)
  535.     ClearMonitor()
  536.     loadMonitor(Monitors.PowerInfo)
  537.     ClearMonitor()
  538.  
  539.     loadMonitor(Monitors.Information)
  540.     Monitors.Information.Setup(Monitors.Information)
  541.     loadMonitor(Monitors.InteractiveMain)
  542.     Monitors.InteractiveMain.Setup(Monitors.InteractiveMain)
  543.     loadMonitor(Monitors.NewsBoard)
  544.     Monitors.NewsBoard.Setup(Monitors.NewsBoard)
  545.     loadMonitor(Monitors.PlayerInfo)
  546.     Monitors.PlayerInfo.Setup(Monitors.PlayerInfo)
  547.     loadMonitor(Monitors.PowerInfo)
  548.     Monitors.PowerInfo.Setup(Monitors.PowerInfo)
  549.     while (true) do
  550.         tryExec(UpdateMonitors)
  551.         os.sleep(0.2)
  552.  
  553.         if (rs.getBundledInput("bottom") == colours.white) then
  554.             return
  555.         elseif (rs.getBundledInput("bottom") ==  colours.orange) then
  556.             os.reboot()
  557.         end
  558.     end
  559. end
  560.  
  561. main()
  562.  
  563. print("Exit button clicked!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement