Advertisement
SteamPunk_Devil

Rednet Test Host

Feb 5th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. --Setting Variables--
  2. local Screen = peripheral.wrap("right") -- connects to the monitor on the right and gives it the local variable Screen
  3. local ID = os.getComputerID() -- gets the computers ID
  4. local PartnerID = "0"
  5.  
  6. --Opens modem--
  7. rednet.open("top") -- Tells CC to use the modem on the top
  8.  
  9. -- Displays ID --
  10. Screen.clear() -- Clears the Screen
  11. Screen.setCursorPos(1,1) -- Resets the pos to start righting from
  12. Screen.write("My ID is "..ID) -- Writes "My ID is ID"
  13.  
  14. -- Finds Partner --
  15.  
  16. while true do -- Opens while loop
  17.     rednet.broadcast(ID) -- sends out  its ID
  18.     print("I have not got a message")
  19.     Screen.clear() -- Clears the Screen
  20.     Screen.setCursorPos(1,1) -- Resets the pos to start righting from
  21.     Screen.write("My partner's ID is "..PartnerID) -- Writes "My partner's ID is ID"
  22.     PartnerID = rednet.receive(59) -- Sets PartnerID to the message it receives (stupid I know but its just testing) or times out after 59 secs
  23.     sleep(1) -- Sleeps for a second
  24. end -- ends loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement