Advertisement
ValveCantCount

start

May 8th, 2015
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.73 KB | None | 0 0
  1. os.loadAPI("phpInterface")
  2. local IOUrl = "softberrykai.com/cc/objc.php"
  3. local function send(url,args)
  4.  phpInterface.setUrl(url)
  5.  local v = phpInterface.sendPostPodyWithArguments(args)
  6.  return v
  7. end
  8. --http.post("http://softberrykai.com/cc/objc.php","label=cs,data=print('Starting COpSys...')")
  9. --http.post("http://softberrykai.com/cc/objc.php","label=luas,data=eventstartup")
  10.  
  11. local function pullClick()
  12.  local event, button, x, y = os.pullEvent("mouse_click")
  13.  local string = "b"..tostring(button).."x"..tostring(x).."y"..tostring(y).."|eventclick"
  14.  local args = {["label"] = "luas", ["data"] = string}
  15.  --phpInterface.setUrl(IOUrl)
  16.  --phpInterface.sendPostPodyWithArguments(args)
  17.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  18. end
  19.  
  20. local function pullKey()
  21.  local event, code = os.pullEvent("key")
  22.  local string = "k"..tostring(code).."|eventkey"
  23.  local args = {["label"] = "luas", ["data"] = string}
  24.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  25. end
  26.  
  27. local function pullScroll()
  28.  local event, direction, x, y = os.pullEvent("mouse_scroll")
  29.  local string = "d"..tostring(direction).."x"..tostring(x).."y"..tostring(y).."|eventscroll"
  30.  local args = {["label"] = "luas", ["data"] = string}
  31.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  32. end
  33.  
  34. local function pullDrag()
  35.  local event,button,x,y = os.pullEvent("mouse_drag")
  36.  local string = "b"..tostring(button).."x"..tostring(x).."y"..tostring(y).."|eventdrag"
  37.  local args = {["label"] = "luas", ["data"] = string}
  38.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  39. end
  40.  
  41. local function pullInsert()
  42.  local event,side = os.pullEvent("disk")
  43.  local string = "s"..side.."|eventdiskinsert"
  44.  local args = {["label"] = "luas", ["data"] = string}
  45.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  46. end
  47.  
  48. local function pullEject()
  49.  local event,side = os.pullEvent("disk_eject")
  50.  local string = "s"..side.."|eventdiskeject"
  51.  local args = {["label"] = "luas", ["data"] = string}
  52.  http.post("http://softberrykai.com/cc/objc.php","label=luas&data="..string)
  53. end
  54.  
  55. local function pullResponse()
  56.  local response = ""
  57.  while response == "" or response == "Data Has Been Read" do
  58.   response = http.post("http://softberrykai.com/cc/objc.php","label=luar&data= ").readAll()
  59.  end
  60.  --print(response)
  61.  loadstring(response)()
  62. end
  63. local x,y = term.getSize()
  64. http.post("http://softberrykai.com/cc/objc.php","label=luar&data= ")
  65. http.post("http://softberrykai.com/cc/objc.php","label=luas&data=x"..tostring(x).."y"..tostring(y).."|eventstartup")
  66. while true do
  67.  pullResponse()
  68.  parallel.waitForAny(pullClick,pullKey,pullScroll,pullDrag,pullInsert,pullEject)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement