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 = "top"
- local coloroff = colors.red;
- local coloron = colors.green;
- local commands = {} --
- commands["boringmachine"] = true -- has to be always true!
- --table.insert(orders,"exctractor",true)
- function send (c,s)
- term.clear()
- print("___________________ Send ___________________")
- if rednet.send(15,c.." "..s) then
- print("sent command.")
- else
- print("Sending not successful.")
- end
- end
- function init ()
- term.clear()
- if rednet.isOpen(WLAN) == false then
- rednet.open(WLAN)
- end
- end
- function menu () -- TODO: lots of writes and formating
- print("___________________ Commands ___________________")
- for i,v in pairs(commands) do
- print(i.." on/off")
- end
- end
- init()
- local answer,command, status
- repeat
- menu()
- print("___________________ Interface ___________________")
- print("Enter command.")
- io.flush()
- answer=io.read() -- or pullevent
- -- 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) -- found status
- write(command)
- if status ~= nil and commands[command] ~= nil then
- write(" ")
- print(status)
- send(command,status)
- else
- print("Error: Command or value not found.")
- end
- else
- print("Error: no Space.")
- end
- until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement