Advertisement
nauseant

CC network remote

May 11th, 2024 (edited)
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. MASTER_CHANNEL = 5452
  2. ELEVATOR_CHANNEL = 47883
  3. PORTAL_CHANNEL = 55290
  4.  
  5. modem = peripheral.find("modem") or error("No modem attached", 0)
  6. args = {...}
  7. recentChannel = 0
  8.  
  9. function jobSelect()
  10.     if args[1] == nil then
  11.         print("No valid job selected!")
  12.         print("'remote [job] [task] [label]'")
  13.         print("E.G. remote elevator call lab")
  14.     elseif args[1] == "elevator" then
  15.         local transmission = args[2].." "..args[3]
  16.         modem.transmit(ELEVATOR_CHANNEL, MASTER_CHANNEL, transmission)
  17.         print("Task signal sent: "..transmission)
  18.         recentChannel = ELEVATOR_CHANNEL
  19.     elseif args[1] == "portal" then
  20.         local transmission = args[2].." "..args[3]
  21.         modem.transmit(PORTAL_CHANNEL, MASTER_CHANNEL, transmission)
  22.         print("Task signal sent: "..transmission)
  23.         recentChannel = PORTAL_CHANNEL
  24.     end
  25.  
  26. end
  27. modem.open(MASTER_CHANNEL)
  28. jobSelect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement