Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("left")
- modem.open(15)
- local f = fs.open("loc.lua", "r")
- loc = tonumber(f.readLine())
- f.close()
- turtle.select(1)
- current = (turtle.getItemCount() > 0 and "2") or "1"
- function switch(new)
- for i = 1, 4 do
- turtle.select(1)
- turtle.digUp()
- turtle.select(new)
- turtle.placeUp()
- turtle.forward()
- turtle.turnRight()
- end
- end
- while true do
- e, _, _, _, message = os.pullEvent("modem_message")
- new = message:sub(loc, loc)
- if new ~= current then
- switch(tonumber(new))
- current = new
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement