anfbckdo

MLD-2.lua

Jan 20th, 2024 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. local monitor = peripheral.wrap("left")
  2. if not monitor then
  3. printError("No monitor found. Please connect a monitor.")
  4. end
  5.  
  6. function monitorTouchDraw(xPos, yPos, xPos2, yPos2)
  7.  
  8. while true do
  9.  
  10. local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  11. local event, side, xPos2, yPos2 = os.pullEvent("monitor_touch")
  12.  
  13. break
  14. end
  15.  
  16. term.redirect(monitor)
  17.  
  18. paintutils.drawLine(xPos, yPos, xPos2, yPos2, 0x1)
  19.  
  20. end
  21.  
  22. while true do
  23. monitorTouchDraw()
  24.  
  25. if os.pullEvent("char") then
  26. local event, character = os.pullEvent("char")
  27. print(character .. " was pressed. Clearing Screen.")
  28. term.setBackgroundColor(colours.black)
  29. term.clear(monitor)
  30. term.native()
  31. end
  32. end
  33.  
Advertisement
Add Comment
Please, Sign In to add comment