Advertisement
Guest User

aaa

a guest
Jun 3rd, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local internet = component.proxy(component.list("internet")())
  2. local modem = component.proxy(component.list('modem')())
  3. local drone=component.proxy(component.list('drone')())
  4.  
  5. function sleep(n)
  6.   local t0 = computer.uptime()
  7.   while computer.uptime() - t0 <= n do computer.pushSignal("wait") computer.pullSignal() end
  8. end
  9.  
  10. while true do
  11.     sleep(0.5)
  12.     drone.setStatusText("F")
  13.     local response = internet.request("http://example.com")
  14.     if response.finishConnect() then
  15.         code, message, header = response.response()
  16.         text = response.read()
  17.         drone.setStatusText("M: "..tostring(text))
  18.     else
  19.         drone.setStatusText("whoeps")
  20.     end
  21.     sleep(3)
  22.     drone.setStatusText("T")
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement