Guest User

gsapi

a guest
Jun 23rd, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. --Made by Bobton Co's. engineers Bob and Sylvyrfysh
  2. --v0.1.1
  3.  
  4. function monBox()
  5.   local monitor = peripheral.wrap("top")
  6.   print("Please click on adjacent corners of the box.")
  7.   local e, m, x, y = os.pullEvent("monitor_touch")
  8.   x1 = x
  9.   y1 = y
  10.   local e,m,x,y = os.pullEvent("monitor_touch")
  11.   term.redirect(monitor)
  12.   paintutils.drawLine(x1,y1,x,y1,1)
  13.   paintutils.drawLine(x1,y1,x1,y,1)
  14.   paintutils.drawLine(x1,y,x,y,1)
  15.   paintutils.drawLine(x,y1,x,y,1)
  16.   term.restore()
  17. end
  18.  
  19. function monClear()
  20.   local monitor = peripheral.wrap("top")
  21.   term.redirect(monitor)
  22.   term.setBackgroundColor(colors.black)
  23.   term.clear()
  24.   term.restore()
  25. end
  26.  
  27. function comTextBox()
  28.   local monitor = peripheral.wrap("top")
  29.   print("Please click on adjacent corners of the box.")
  30.   local event, button, x, y = os.pullEvent("mouse_click")
  31.   x1 = x
  32.   y1 = y
  33.   local event, button, x, y = os.pullEvent("mouse_click")
  34.   l1 = x - x1
  35.   l = l1 - 4
  36.   m = 1
  37.   while m == 1 do
  38.     write("Enter your Text: "..l.." characters max: ")
  39.     r = io.read()
  40.     if string.len(r) > l then
  41.       print("Too long.")
  42.     else
  43.       paintutils.drawLine(x1,y1,x1,y,1)
  44.       paintutils.drawLine(x1,y1,x,y1,1)
  45.       paintutils.drawLine(x1,y,x,y,1)
  46.       paintutils.drawLine(x,y1,x,y,1)
  47.       term.setCursorPos(x1 + 2, y1 + 2)
  48.       print(r)
  49.       m = 0
  50.       return
  51.     end
  52.   end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment