Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Multifloor Listener V0.1 by QQII
- --Declerations
- local Arguments = { ... } --Program arguments
- local currentFloor = tonumber(Arguments[1])
- local modem = peripheral.wrap("right") --Wraps the modem on the right side.
- local block = 0 --Slot that contains a block
- --Initial
- if currentFloor == null then
- print("ERROR: currentFloor = null")
- return
- end
- if (not modem) or (peripheral.getType("right") ~= "modem") then
- print("ERROR: no wireless modem found")
- return
- end
- for i = 1,16 do
- if turtle.getItemCount(i) ~= 0 then
- block = i
- end
- end
- if block == 0 then
- print("ERROR: no blocks found")
- return
- else
- turtle.select(block)
- end
- modem.open(1000)
- --Main Loop
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if message == currentFloor then
- turtle.place()
- os.sleep(10)
- turtle.dig()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement