Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Please enter what this program runs through(turtle/tablet): ")
- local input = read()
- term.clear()
- print("Good")
- -- tablet --
- if input == "tablet" then
- print("Please enter a communication channel from 2 to 65535(This channel must match the turtle channel): ")
- local inputCHx = read()
- term.clear()
- print("Good")
- local inputCH = inputCHx + 0
- local modem = peripheral.wrap("back")
- while true do
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" then
- modem.transmit(inputCH, (inputCH - 1), param)
- end
- end
- end
- -- turtle --
- if input == "turtle" then
- print("Please enter a communication channel from 2 to 65535(This channel must match the tablet channel): ")
- local inputCHx = read()
- term.clear()
- print("Good")
- local inputCH = inputCHx + 0
- local modem = peripheral.wrap("right")
- while true do
- modem.open(inputCH)
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- local key = message + 0
- if key == 87 then -- W --
- turtle.forward()
- elseif key == 65 then -- A --
- turtle.turnLeft()
- elseif key == 83 then -- S --
- turtle.back()
- elseif key == 68 then -- D --
- turtle.turnRight()
- elseif key == 81 then -- Q --
- turtle.down()
- elseif key == 69 then -- E --
- turtle.up()
- elseif key == 70 then -- F --
- turtle.dig()
- end
- end
- end
- print("Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement