Advertisement
ccraftersanonmoose

rednet send message test

Feb 17th, 2023 (edited)
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | Gaming | 0 0
  1. -- Test script for working with rednet
  2. -- wriiten by craftersanonmoose
  3. -- want to try sending messages from one computer to another and then display those messages
  4. -- using button to send a predefined message
  5.  
  6. ----------------------------------
  7.  
  8. os.loadAPI("button")
  9. mon = peripheral.find("monitor")
  10. --wmod = peripheral.wrap("right")
  11. mon.clear()
  12.  
  13. rednet.open("right")
  14.  
  15.  
  16. function fillTable()
  17. button.setTable("Send", sendMessage, 10,20,3,5)
  18. button.screen()
  19. end
  20.  
  21. function getClick()
  22. event,side,x,y = os.pullEvent("monitor_touch")
  23. button.checkxy(x,y)
  24. end
  25.  
  26.  
  27. function sendMessage()
  28. rednet.send(10, "Hello from another computer!")
  29. mon.setCursorPos(12,7)
  30. mon.write("Message Sent")
  31. end
  32.  
  33. fillTable()
  34. button.heading("Instant Messanger")
  35.  
  36. while true do
  37. getClick()
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement