Godleydemon

rednet message send

Jun 8th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. isWirelessTurtle = peripheral.isPresent("right")
  2. if (isWirelessTurtle == true) then
  3.   turtleId = os.getComputerLabel()
  4.   rednet.open("right")
  5. end
  6.  
  7. function writeMessage(message)
  8.     print(message)
  9.  
  10.     -- If this turtle has a modem, then write the message to red net
  11.     if (isWirelessTurtle == true) then
  12.       if (turtleId == nil) then
  13.         rednet.broadcast(message)
  14.       else
  15.         -- Broadcast the message (prefixed with the turtle's id)
  16.         rednet.broadcast("[".. turtleId.."] "..message)
  17.       end
  18.     end
Advertisement
Add Comment
Please, Sign In to add comment