Guest User

1

a guest
Oct 15th, 2013
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function drag()
  2.  while true do
  3.    event, button, X, Y = os.pullEvent("mouse_drag") -- ### mouse drag function
  4.    XY = X..","..Y
  5.    
  6.      event, button, X2, Y2 = os.pullEvent("mouse_click") -- click (close) function
  7.      XY2 = X2..","..Y2
  8.     if button == 1 then -- window design
  9.       term.setBackgroundColor(8)
  10.       shell.run("clear")
  11.       term.setBackgroundColor(8)
  12.       term.setCursorPos(X-8,Y)
  13.       term.setBackgroundColor(2048)
  14.       write("Test            ")
  15.       term.setBackgroundColor(1)
  16.       term.setBackgroundColor(16384)
  17.       write("X")
  18.       term.setBackgroundColor(256)
  19.       term.setCursorPos(X-8,Y+1)
  20.       print("                 ")
  21.       term.setCursorPos(X-8,Y+2)
  22.       print("     Hello       ")
  23.       term.setCursorPos(X-8,Y+3)
  24.       print("                 ")
  25.       term.setCursorPos(X-8,Y+4)
  26.       print("                %")
  27.     end
  28.     if XY2 == "X+8,Y" and button == 1 then -- #### X position
  29.     shell.run("reboot")
  30.   end
  31.  end
  32. end
  33. term.setBackgroundColor(8)
  34. shell.run("clear")
  35. print("Drag the mouse..\n# ----drag---> #")
  36. parallel.waitForAny(drag, click)
RAW Paste Data