Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- установщик маркеров в шахте, для карьера bildcraft by serafim http://pastebin.com/pd035mnV
- -- положить в слот 1 маркеры, 4 штуки
- -- дать в руку робота кирку
- -- пример запуска: bild 63 ,63 - длинна рамки
- local a = {...}
- local length = tonumber(a[1]) or 63
- local com = require('component')
- if not com.isAvailable("robot") then
- print("только роботы могут использовать эту программу")
- os.exit()
- end
- local robot = require("robot")
- if length < 4 then
- print("длинна рамки должна быть больше 4")
- os.exit()
- end
- if robot.count(1) < 4 then
- print("положите 4 маркера в слот № 1")
- os.exit()
- end
- function bild()
- robot.select(1)
- print("строю рамку длинной: "..length)
- for j = 1, 4 do
- for i = 1, length do
- while robot.detectUp() do
- robot.swingUp()
- end
- while robot.detect() do
- robot.swing()
- end
- while not robot.forward() do
- robot.swing()
- end
- if i == length then
- robot.swingDown()
- if robot.placeDown() then
- print("ставлю маркер № "..j)
- else
- print("не могу поставить маркер № "..j)
- end
- end
- end
- robot.turnRight()
- end
- end
- bild()
- print("готово")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement