Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local supply = peripheral.wrap("right")
- supply.link()
- for i = 1,6 do
- turtle.forward()
- end
- local move = function(f)
- while not f() do
- sleep(0.3)
- end
- sleep(0.1)
- end
- local place = function(color)
- if turtle.getItemCount(1) < 2 then
- supply.resupply(1)
- end
- turtle.place()
- local lamp = peripheral.wrap("front")
- lamp.setColor(tonumber(color,16))
- end
- local f = fs.open("dw.txt","r")
- local img = {}
- line = f.readLine()
- while line ~= nil do
- table.insert(img,line)
- line = f.readLine()
- end
- f.close()
- h,w = #img, #img[1]/8
- r,c = h,1
- while true do
- if c > w then break end
- place(img[r]:sub(1+8*(c-1),1+8*(c-1)+7))
- while r > 1 do
- move(turtle.up)
- r = r - 1
- place(img[r]:sub(1+8*(c-1),1+8*(c-1)+7))
- end
- turtle.turnRight()
- move(turtle.forward)
- turtle.turnLeft()
- c = c + 1
- if c > w then break end
- place(img[r]:sub(1+8*(c-1),1+8*(c-1)+7))
- while r < h do
- move(turtle.down)
- r = r + 1
- place(img[r]:sub(1+8*(c-1),1+8*(c-1)+7))
- end
- turtle.turnRight()
- move(turtle.forward)
- turtle.turnLeft()
- c = c + 1
- end
- if w % 2 == 1 then
- while not turtle.detectDown() do
- turtle.down()
- sleep(0.3)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement