Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- For use with a pocket computer!
- -- Command Structure: "controller direction start_station_name end_station_name"
- -- Example Usage: "controller up my_cool_station my_even_cooler_station"
- local TRAIN_COMM_PORT = 101
- local modem = peripheral.wrap("back")
- local args = {...}
- local direction = args[1]
- local start_station_name = args[2]
- local end_station_name = args[3]
- if (not direction == "up") and (not direction == "down") then
- print("ERROR: INVALID DIRECTION! (Must be 'up' or 'down')")
- shell.exit()
- end
- local direction_port = 103
- if direction == "up" then
- direction_port = 104
- end
- modem.transmit(TRAIN_COMM_PORT, 102, start_station_name)
- sleep(15)
- while true do
- modem.transmit(TRAIN_COMM_PORT, direction_port, end_station_name)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement