Untitled

mail@pastecode.io avatar
unknown
plain_text
20 days ago
1.1 kB
2
Indexable
Never

-- Find a modem
local sModemSide = nil
for n,sSide in ipairs( rs.getSides() ) do
    if peripheral.getType( sSide ) == "modem" and peripheral.call( sSide, "isWireless" ) then    
        sModemSide = sSide
        break
    end
end
rednet.open(sModemSide)

print("enter x")
x = io.read()
if x == "gps" then
  x, _, _ = gps.locate(10)
else
  x = tonumber( x )
end

print("enter z")
z = io.read()
if z == "gps" then
  _, _, z = gps.locate(10)
else
  z = tonumber( z )
end

print("pre launch test...")

rednet.broadcast({"check", {x=x,y=66,z=z,delay=0}})

id, message = rednet.receive(5)

print("error", message.check[1])
print("blocking", message.check[2])
print("statusKey", message.check[3])
print("statusMessage", message.check[4])
print("distance", message.distance)
print("travel time", 999999)
print("inaccuracy", message.inaccuracy)

print("---")
print("Press enter to confirm launch...")

io.read()

print("launching...")

rednet.broadcast({"launch", {x=x,y=66,z=z,delay=0}, {"a","b"} })

id, message = rednet.receive(15)

print(message[1])
print(message[2])
print(message[3])
print(message[4])
Leave a Comment