Advertisement
Alexr360

Bastion Reciever Fireplace

Feb 23rd, 2024 (edited)
935
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function bastion()
  2.     local modem = peripheral.find("modem") or error("No modem attached", 0)
  3.     modem.open(15) -- Open 43 so we can receive replies
  4.  
  5.     -- And wait for a reply
  6.     local event, side, channel, replyChannel, message, distance
  7.     repeat
  8.       event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
  9.     until channel == 15
  10.  
  11.     -- Process the received message based on its content
  12.     if message == "Recal" then
  13.         print("Recalling Player...")
  14.         modem.transmit(43, 15, "Recalling Player...")
  15.         turtle.forward()
  16.         os.sleep(1)  -- Keep the signal for 1 seconds
  17.         turtle.back()
  18.         print("Back")
  19.     end
  20. end
  21.  
  22. term.clear()
  23. term.setCursorPos(1, 1)
  24. print("Bastion Network Online!")
  25.  
  26. -- Main loop
  27. while true do
  28.     bastion()
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement