Advertisement
DevilTvLP

openComputersRedstone

Jun 26th, 2018 (edited)
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local name = ""
  2. local channel = ""
  3. local channelPassword = ""
  4. local side = require("sides").left
  5.  
  6. --*************Program start*********************
  7. local component = require("component")
  8. local tcp = require("tcp")
  9.  
  10. client = tcp:connect(name)
  11. if client:isConnected() then
  12.   client:sendString("createChannel "..channel.." "..channelPassword)
  13.   client:sendString("joinChannel "..channel.." "..channelPassword)
  14.   client:sendString("listenToChannel "..channel)
  15.  
  16.   while true do
  17.     rcv = client:receiveString()
  18.     tcp:execute(rcv, function(channel, from, label, args)
  19.       if label=="on" then component.redstone.setOutput(side, 15) end
  20.       if label=="off" then component.redstone.setOutput(side, 0) end
  21.     end)
  22.   end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement