Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- local modem = peripheral.find("modem", rednet.open) -- doing it like this finds all modem peripherals and then opens rednet on them
- local tPos
- --- MAIN
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextScale(0.5)
- monitor.write("Hello, ID: " .. os.computerID()) --the id of the computer
- function vec3ToString(vec3)
- local str = ("(x:" .. math.floor(vec3.x+0.5) .. ", y:" .. math.floor(vec3.y+0.5) .. ", z:" .. math.floor(vec3.z+0.5) .. ")")
- return str
- end
- function receivePosMessage()
- local id, message = rednet.receive(nil,0.5)
- if (message == nil) then return end
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Message from ID: " .. id .. " = " .. vec3ToString(message))
- tPos = message
- end
- function update()
- receivePosMessage()
- end
- while true do
- sleep(0.5)
- update()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement