Advertisement
remie92

Basic Mainframe Touchscreen

Feb 25th, 2024 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. local monitor = peripheral.wrap("left")
  2. local lib = require("internet")
  3. lib.enableNet()
  4. monitor.setTextScale(5) --8x5 screen
  5. monitor.clear()
  6. monitor.setTextColor(colors.orange)
  7. monitor.setCursorPos(1,1)
  8. monitor.write("^")
  9. monitor.setCursorPos(1,3)
  10. monitor.write("!")
  11.  
  12. monitor.setCursorPos(4,1)
  13. monitor.write("#")
  14. monitor.setCursorPos(3,2)
  15. monitor.write("#")
  16. monitor.setCursorPos(4,3)
  17. monitor.write("#")
  18. monitor.setCursorPos(5,2)
  19. monitor.write("#")
  20.  
  21. monitor.setCursorPos(1,5)
  22. monitor.write("<")
  23. monitor.setCursorPos(3,5)
  24. monitor.write(">")
  25.  
  26. while true do
  27. local event, side, x, y = os.pullEvent("monitor_touch")
  28. if x==1 and y==1 then
  29. print("Sending turtle up")
  30. lib.sendMessage("turtle.digUp() turtle.up()")
  31. end
  32. if x==1 and y==3 then
  33. print("Sending turtle down")
  34. lib.sendMessage("turtle.digDown() turtle.down()")
  35. end
  36. if x==4 and y==1 then
  37. print("Sending turtle forward")
  38. lib.sendMessage("turtle.dig() turtle.forward()")
  39. end
  40. if x==4 and y==3 then
  41. print("Sending turtle forward")
  42. lib.sendMessage("turtle.back()")
  43. end
  44. if x==1 and y==5 then
  45. print("Sending turtle forward")
  46. lib.sendMessage("turtle.turnLeft()")
  47. end
  48. if x==3 and y==5 then
  49. print("Sending turtle forward")
  50. lib.sendMessage("turtle.turnRight()")
  51. end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement