Roukurai

Induction Matrix Display

Jul 23rd, 2021
1,038
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("gui.lua")
  2. modem = peripheral.find("modem")
  3. monitor = peripheral.find("monitor")
  4.  
  5. oldterm = term.redirect(monitor)
  6. firstBoot = true
  7. if firstBoot == true then
  8.     term.clear()
  9.     term.setCursorPos(1,1)
  10.     firstBoot = false
  11. end
  12. function defaultColor()
  13.     term.setBackgroundColor(colors.black)
  14.     term.setTextColor(colors.white)
  15. end
  16. if modem.isWireless() == true then
  17.     if modem.isOpen(1) == false then
  18.         modem.open(1)
  19.         write("Channel 1 opened")
  20.     end
  21. else
  22.     print("No wireless modem found")
  23. end
  24. defaultColor()
  25.  
  26. while true do
  27.     event, _, receiveCH, respondCH, energyDetails = os.pullEvent("modem_message")
  28.     term.setCursorPos(1,1)
  29.        
  30.     print("Current energy levels...")
  31.     write(energyDetails[1].." / "..energyDetails[2])
  32.     energyStr = energyDetails[1].." / "..energyDetails[2]
  33.     leng = string.len(energyStr)
  34.     curX, curY = term.getCursorPos()
  35.     gui.drawProg(1,curY+2,leng,3,energyDetails[1],energyDetails[2],colors.white,colors.green)
  36.     defaultColor()
  37.     curX,curY = term.getCursorPos()
  38.  
  39.     term.setCursorPos(1,curY+2)
  40.     write("Current Input")
  41.     curX, curY = term.getCursorPos()
  42.     inputStr = string.len(energyDetails[3])
  43.     term.setCursorPos(inputStr+curX,curY)
  44.     print("Current Output")
  45.     write(energyDetails[3])
  46.     term.setCursorPos(inputStr+curX, curY+1)
  47.     print(energyDetails[4])
  48.    
  49.     print("Max transfer rate:"..energyDetails[5])
  50.      
  51.    
  52.  
  53. end
  54. term.redirect(oldterm)
  55.  
RAW Paste Data