Advertisement
Guest User

Mainframe.lua

a guest
Dec 15th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. --CertusianOS
  2. --ATM3 Comp.Craft OS
  3.  
  4. --tell PC that the monitor is on top
  5. mon = peripheral.wrap("top")
  6.  
  7. --creats mouse variables
  8. mouseWidth = 0
  9. mouseHeight = 0
  10.  
  11. --Clears the monitor
  12. mon.clear()
  13.  
  14. --set mouse position
  15. mon.setCursorPos(1,1)
  16.  
  17. --Gets monitor size and sets it to variables
  18. w, h=mon.getSize()
  19.  
  20. --Displays monitor size
  21. print(w)
  22. print(h)
  23.  
  24. mon.clear()
  25.  
  26. --sets monitor colors.
  27. mon.clear()
  28. mon.setTextColor(colors.cyan)
  29. mon.setBackgroundColor(colors.white)
  30. mon.clear()
  31. mon.setCursorPos(6,2)
  32. mon.write("o-----------------o")
  33. mon.setCursorPos(6,3)
  34. mon.write("|  Certusian Inc  |")
  35. mon.setCursorPos(6,4)
  36. mon.write("|                 |")
  37. mon.setCursorPos(6,5)
  38. mon.write("|     [Login]     |")
  39. mon.setCursorPos(12,5)
  40. mon.write("x")
  41. mon.setCursorPos(18,5)
  42. mon.write("x")
  43. function checkClickPosition()
  44.   if mouseWidth > 12 and mouseWidth < 18 and mouseHeight == 5 then
  45.     mon.clear()
  46.     mon.setCursorPos(1,1)
  47.     mon.write("It worked")
  48.   end
  49. end
  50.  
  51. repeat
  52.   event,p1,p2,p3 = os.pullEvent()
  53.   if event=="monitor_touch" then
  54.     mouseWidth = p2
  55.     mouseHeight = p3
  56.   end
  57.  
  58. until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement