View difference between Paste ID: d9CBNDCz and R9NXSxDx
SHOW: | | - or go back to the newest paste.
1
--[[
2
	2013 (c) psychedelixx
3-
	Minecraft Turtle: Stairs
3+
	Minecraft Turtle: Diagonal Hallway
4-
	2013-05-21
4+
	2013-05-24
5
6-
	Digs a simple stair and places missing ground blocks and torches (every 4th horizontal block).
6+
	Digs a diagonal hallway and places missing ground blocks and torches.
7
8
	Usage: 
9
	- use turtle and type "label set <name>" 
10
	  (to give your turtle an unique name so it remembers its programs)
11-
	- type "pastebin get R9NXSxDx stairs"
11+
	- type "pastebin get d9CBNDCz diagonal"
12
	- place solid blocks in slot 16 (lower right corner)
13
	- place torches in slot 15 (left of slot 16)
14-
	- type "stairs <height> [<limit>]"
14+
	- type either "diagonal left ###" or "diagonal right ###" (replace ### with a number)
15-
		• where <height> represents the height of the hallway (3-5 seems good)
15+
16-
		• and <limit> (optional) represents the Y coordinates digged down
16+
17-
		  (if you're at y64 and type in 10, it will dig until it's at y54)
17+
function move()
18
	print(turtle.getFuelLevel())
19
        if turtle.getFuelLevel() < 5 then
20
                turtle.refuel()
21-
if #args < 1 then
21+
        end
22-
  print( "Usage: stairs <height> [<limit>]" )
22+
        if not turtle.detectDown() then 
23
                turtle.select(16)
24
                turtle.placeDown()
25-
height = tonumber(args[1])
25+
        end
26-
limit = 256
26+
 
27-
if #args == 2 then
27+
        while not turtle.forward() do
28-
	limit = tonumber(args[2])
28+
                turtle.dig()
29
        end
30
end
31-
if height < 2 then
31+
32-
  print( "The height must be >= 2." )
32+
33
if #args < 2 then
34
  print( "Usage: diagonal <direction> (right / left) <limit>" )
35
  error()
36
end
37
dir = args[1]
38-
	while limit > 0 do
38+
limit = tonumber(args[2])
39
40-
	        if turtle.getFuelLevel() < height*2 then
40+
if turtle.getFuelLevel() == 0 then
41-
	                turtle.refuel()
41+
	turtle.refuel()
42-
	        end
42+
43-
	        if turtle.getFuelLevel() < height*2 then
43+
44-
	                print("Fuel is almost empty!")
44+
if turtle.getFuelLevel() == 0 then
45-
	        end
45+
	print("I need fuel!")
46
else
47
	print("======== 2013 (c) psychedelixx ========")
48
	print("Let's go!")
49-
		print("Next torch in: " .. limit%4 .. "m")
49+
50
	move()
51-
		for var = 0, height-3 do
51+
	turtle.digUp()
52-
			turtle.digUp()
52+
	if dir == "left" then
53-
			if var < height-3 then
53+
		turtle.turnLeft()
54-
				turtle.up()
54+
	else
55-
			end
55+
		turtle.turnRight()
56-
			if var == 0 and limit%4 == 0 then
56+
	end
57-
				turtle.turnRight()
57+
	move()
58-
				turtle.dig()
58+
	turtle.digUp()
59-
				turtle.select(15)
59+
	if dir == "left" then
60-
				turtle.place()
60+
		turtle.turnRight()
61-
				turtle.turnLeft()
61+
	else
62-
			end
62+
		turtle.turnLeft()
63
	end	
64-
		for var = 0, height-4 do turtle.down() end
64+
	while turtle.detect() do turtle.dig() end
65-
		turtle.digDown()
65+
	turtle.up()
66
	while turtle.detect() do turtle.dig() end
67-
		if not turtle.detectDown() then	
67+
	if dir == "left" then
68-
			turtle.select(16)
68+
		turtle.turnLeft()
69-
			turtle.placeDown()
69+
	else
70
		turtle.turnRight()
71
	end
72-
	        while not turtle.forward() do
72+
	while turtle.detect() do turtle.dig() end
73-
 	               turtle.dig()
73+
	turtle.down()
74-
	        end
74+
	move()
75
	if dir == "left" then
76-
		turtle.forward()
76+
		turtle.turnRight()
77
	else
78-
	end
78+
		turtle.turnLeft()
79
	end	
80
	
81
	torchCount = 0
82
	while turtle.getFuelLevel() > 0 and limit > 0 do
83
		print("")
84
		print("Remaining: " .. limit) 
85
		print("Fuel: " .. turtle.getFuelLevel())
86
	
87
		move()
88
		turtle.digUp()
89
		while turtle.detect() do turtle.dig() end
90
		turtle.up()
91
		while turtle.detect() do turtle.dig() end
92
93
		if torchCount%4 == 0 then 
94
			turtle.select(15)
95
			turtle.place()
96
		end
97
		
98
		if dir == "left" then
99
			turtle.turnLeft()
100
		else
101
			turtle.turnRight()
102
		end
103
		while turtle.detect() do turtle.dig() end
104
		turtle.down()
105
		move()
106
		
107
		if dir == "left" then
108
			turtle.turnRight()
109
		else
110
			turtle.turnLeft()
111
		end
112
		
113
		limit = limit-1
114
		torchCount = torchCount + 1
115
	end
116
	move()
117
	turtle.digUp()
118
end