Advertisement
Uranium_49

Untitled

Mar 1st, 2025
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.86 KB | None | 0 0
  1. rednet.open("bottom")
  2. m = peripheral.wrap("top")
  3. m.setBackgroundColor(colors.black)
  4. m.clear()
  5. m.setTextScale(0.5)
  6.  
  7. data = {}
  8.  
  9. local i = 0
  10.  
  11. for i = 0, 50 do
  12.     data[i] = {}
  13. end
  14.  
  15. window[27] = window.create(m,50,10,30,15,true)
  16. window[28] = window.create(m,50,30,30,15,true)
  17. window[29] = window.create(m, 10, 10, 30, 15, true)
  18. window[30] = window.create(m, 10,30,30,15,true)
  19. window[31] = window.create(m, 140,5,15,7,true)
  20.  
  21. for i = 27,31 do
  22.     window[i].setBackgroundColor(colors.white)
  23.     window[i].setTextColor(colors.black)
  24.     window[i].clear()
  25.     x,y = window[i].getSize()
  26. end
  27.  
  28. function boxe(x, y, xa, ya, mon, titre)
  29.     mon.setTextScale(1)
  30.     mon.setCursorPos(x, y)
  31.     mon.setBackgroundColor(colors.gray)
  32.     mon.write("  ")
  33.     mon.setBackgroundColor(colors.black)
  34.     mon.setTextColor(colors.yellow)
  35.     mon.setCursorPos(x + 2, y)
  36.     mon.write(" " .. titre .. " ")
  37.     local xc, yc = mon.getCursorPos()
  38.     for xc = xc, xa + x do
  39.         mon.setCursorPos(xc, y)
  40.         mon.setBackgroundColor(colors.gray)
  41.         mon.write(" ")
  42.         xc = xc + 1
  43.     end
  44.     local xc, yc = mon.getCursorPos()
  45.     yc = y + 1
  46.     for yc = y, ya + y do
  47.         mon.setCursorPos(x, yc)
  48.         mon.setBackgroundColor(colors.gray)
  49.         mon.write(" ")
  50.         mon.setCursorPos(x + xa, yc)
  51.         mon.setBackgroundColor(colors.gray)
  52.         mon.write(" ")
  53.         yc = yc + 1
  54.     end
  55.     xb = x
  56.     for xb = x, xa + x do
  57.         mon.setCursorPos(xb, y + ya)
  58.         mon.setBackgroundColor(colors.gray)
  59.         mon.write(" ")
  60.         xb = xb + 1
  61.     end
  62. end
  63.  
  64. function fetchData()
  65.  
  66.     while true do
  67.    
  68.         e,a,b,c = os.pullEvent("rednet_message")
  69.         data[a] = b
  70.         data[a]["name"] = c
  71.        
  72.         window[a].setCursorPos(1,1)
  73.         window[a].write("  "..data[a]["name"])
  74.         window[a].setCursorPos(1,2)
  75.         window[a].write("Energy Used: "..data[a]["energyUse"])
  76.         window[a].setCursorPos(1,3)
  77.         window[a].write("input: "..data[a]["input1"].name.."             ")
  78.         window[a].setCursorPos(1,4)
  79.         window[a].write("count: "..data[a]["input1"].count.."              ")
  80.         window[a].setCursorPos(1,5)
  81.         window[a].write("output: "..data[a]["output1"].name.."           ")
  82.         window[a].setCursorPos(1,6)
  83.         window[a].write("count: "..data[a]["output1"].amount.."      ")
  84.        
  85.        
  86.     end
  87.  
  88. end
  89.  
  90.  
  91. --window[i].setBackgroundColor(colors.green)
  92. --window[i].setTextColor(colors.black)
  93. --window[i].clear()
  94.  
  95. function printWindow(i)
  96.  
  97.     window[i].setCursorPos(1,1)
  98.     window[i].write(data[i]["name"])
  99.     window[i].setCursorPos(1,2)
  100.     window[i].write("input: "..data[i]["input1"].count)
  101.  
  102. end
  103.  
  104. function print()
  105.  
  106.     --os.sleep(5)
  107.  
  108.     for i=29,30 do
  109.    
  110.         --printWindow(i)
  111.        
  112.     end
  113.    
  114. end
  115.  
  116. parallel.waitForAll(fetchData, print)
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement