Advertisement
goldfiction

rednetsend

Jan 4th, 2024
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. function broadcast(message)
  2.     if(turtleId==nil) then
  3.       turtleId = os.getComputerLabel()
  4.     end
  5.  
  6.     if(turtleId==nil) then
  7.       http.post("http://rwind.tk:3000/print","msg=[no id] "..message)
  8.     else
  9.       http.post("http://rwind.tk:3000/print","msg=".."[".. turtleId.."] "..message)
  10.     end
  11.  
  12.     if (isWirelessTurtle == true) then
  13.       if (turtleId == nil) then
  14.         rednet.broadcast(message)
  15.       else
  16.         -- Broadcast the message (prefixed with the turtle's id)
  17.         rednet.broadcast("[".. turtleId.."] "..message)
  18.       end
  19.     end
  20. end
  21.  
  22. term.clear()
  23. term.setCursorPos(1,1)
  24. io.write("Message: ")
  25. message = io.read()
  26. broadcast(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement