Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function drag()
- while true do
- event, button, X, Y = os.pullEvent("mouse_drag") -- ### mouse drag function
- XY = X..","..Y
- event, button, X2, Y2 = os.pullEvent("mouse_click") -- click (close) function
- XY2 = X2..","..Y2
- if button == 1 then -- window design
- term.setBackgroundColor(8)
- shell.run("clear")
- term.setBackgroundColor(8)
- term.setCursorPos(X-8,Y)
- term.setBackgroundColor(2048)
- write("Test ")
- term.setBackgroundColor(1)
- term.setBackgroundColor(16384)
- write("X")
- term.setBackgroundColor(256)
- term.setCursorPos(X-8,Y+1)
- print(" ")
- term.setCursorPos(X-8,Y+2)
- print(" Hello ")
- term.setCursorPos(X-8,Y+3)
- print(" ")
- term.setCursorPos(X-8,Y+4)
- print(" %")
- end
- if XY2 == "X+8,Y" and button == 1 then -- #### X position
- shell.run("reboot")
- end
- end
- end
- term.setBackgroundColor(8)
- shell.run("clear")
- print("Drag the mouse..\n# ----drag---> #")
- parallel.waitForAny(drag, click)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement