Advertisement
jaklsfjlsak

监视器频道控制

Jul 25th, 2023 (edited)
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. --- set Video Channels of each side
  2. local frontChannel = 63060
  3. local backChannel = 19174
  4. local leftChannel = 105
  5. local rightChannel = 48046
  6. local topChannel = 24636
  7. --- detects if there even is a Monitor attached
  8. local screen = peripheral.find("warpdriveMonitor")
  9.  
  10. if not screen then
  11.     print("No Monitor Connected.")
  12. end
  13.  
  14. if screen.isInterfaced() == false then
  15.     print("No Computer Interface Upgrade Installed.")
  16. end
  17.  
  18. print("WD Monitor Configuration Assistant")
  19. print("Press W A S D for Sides and Q for Top to Select Camera")
  20.  
  21. function freqFront()
  22.     screen.videoChannel(frontChannel)
  23. end
  24. function freqBack()
  25.     screen.videoChannel(backChannel)
  26. end
  27. function freqLeft()
  28.     screen.videoChannel(leftChannel)
  29. end
  30. function freqRight()
  31.     screen.videoChannel(rightChannel)
  32. end
  33. function freqTop()
  34.     screen.videoChannel(topChannel)
  35. end
  36.  
  37. while true do
  38.     os.sleep(0.5)
  39.     local event, key = os.pullEvent()
  40.  
  41.     if event == "key" then
  42.         -- keys are represented by numbers, the number for 'W' is 17
  43.         if key == 17 then
  44.             print("Monitor Connected to Front Camera")
  45.             freqFront()
  46.         -- keys are represented by numbers, the number for 'S' is 31
  47.         elseif key == 31 then
  48.             print("Monitor Connected to Rear Camera")
  49.             freqBack()
  50.         -- keys are represented by numbers, the number for 'A' is 30
  51.         elseif key == 30 then
  52.             print("Monitor Connected to Left Camera")
  53.             freqLeft()
  54.         -- keys are represented by numbers, the number for 'D' is 32
  55.         elseif key == 32 then
  56.             print("Monitor Connected to Right Camera")
  57.             freqRight()
  58.         -- keys are represented by numbers, the number for 'Q' is 16
  59.         elseif key == 16 then
  60.             print("Monitor Connected to Top Camera")
  61.             freqTop()
  62.         end
  63.      end
  64. end
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement