Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Control_Interface:14
- Control_RedstoneServer:15
- Control_RedstoneClient1:24
- Control_Bee:25
- --]]
- local WLAN = "bottom"
- local commands = {} --
- commands["boringmachine"] = 1 -- not nil!
- function send (c,s)
- print(c..":"..s)
- if c == 1 then
- -- redstone
- if s == "on" then
- redstone.setOutput("left", false)
- elseif s == "off" then
- redstone.setOutput("left", true)
- end
- else
- if rednet.send(24,c.." "..s) then
- print("sent command.")
- else
- print("Sending not successful.")
- end
- end
- end
- function init ()
- if rednet.isOpen(WLAN) == false then
- rednet.open(WLAN)
- end
- end
- init()
- local answer,command, status
- repeat
- io.flush()
- _,_,answer= os.pullEvent("rednet_message")
- -- check answer
- answer = string.lower(answer)
- command, status = string.find(answer," ") -- found positions
- if command ~= nil then
- command = string.sub(answer, 1, command-1) -- found command
- status = string.sub(answer, status+1) -- found status
- if status ~= nil and commands[command] ~= nil then
- send(commands[command],status)
- end
- end
- until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement