biodude100

computer craft touch screen

Jun 6th, 2014 (edited)
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. m=peripheral.wrap("right")
  2.  
  3. m.setBackgroundColor(colors.black)
  4.  
  5. m.clear()
  6.  
  7. function wt(x,y,t,c)
  8. m.setBackgroundColor(c) --use {colors.black} for c
  9. m.setCursorPos(x,y)
  10. m.write(t) --use {"your text here"} for t
  11. end
  12.  
  13.  
  14.  
  15. function Touch()
  16. if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
  17. redstone.setOutput("right",true)
  18. elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
  19. redstone.setOutput("right",false)
  20. end
  21. end
  22.  
  23. repeat
  24. event,p1,p2,p3 = os.pullEvent()
  25. if event=="monitor_touch" then
  26. mouseWidth = p2
  27. mouseHeight = p3
  28. Touch()
  29. end
  30. until event=="char" and p1==("x") --press x to exit
Add Comment
Please, Sign In to add comment