SHOW:
|
|
- or go back to the newest paste.
1 | -- uses hobo api t. ver 3.1.1 | |
2 | ||
3 | local turns = 0 | |
4 | local height = 0 | |
5 | local maxheight = 0 | |
6 | local distance = 1 | |
7 | local maxdistance = 0 | |
8 | ||
9 | print("This makes a 4 walls of equal height and length") | |
10 | print("It will make right turns at the end of each wall to make a box") | |
11 | print("place the turtle on the floor of a corner and make sure the area is clear") | |
12 | ||
13 | print("") | |
14 | ||
15 | print("How tall should the wall be ?") | |
16 | ||
17 | maxheight = tonumber(read()) | |
18 | ||
19 | print("How long Should the wall be") | |
20 | ||
21 | maxdistance = tonumber(read()) | |
22 | ||
23 | print("The wall will be ".. maxheight.." blocks tall and " .. maxdistance.." blocks long") | |
24 | ||
25 | local blockcount = maxheight * maxdistance * 4 | |
26 | ||
27 | print("The wall needs "..blockcount.." blocks") | |
28 | ||
29 | print("Make sure the turtle has fuel and the wall block is in slot 1") | |
30 | ||
31 | print("Start Y/N") | |
32 | ||
33 | local ready = read() | |
34 | ||
35 | if ready ~= "y" and ready ~= "Y" then | |
36 | return | |
37 | ||
38 | end | |
39 | ||
40 | select(1) | |
41 | local blockCount = turtle.getItemCount() | |
42 | local wallblock = turtle.getItemDetail() | |
43 | ||
44 | ||
45 | local selected = {} | |
46 | local function findBlock() | |
47 | ||
48 | for i = 1 , 16 do | |
49 | turtle.select(i) | |
50 | if turtle.getItemCount() ~= 0 then | |
51 | selected = turtle.getItemDetail() | |
52 | if selected.name == wallblock.name then | |
53 | blockCount = turtle.getItemCount() | |
54 | return | |
55 | end | |
56 | end | |
57 | end | |
58 | ||
59 | end | |
60 | ||
61 | ||
62 | local function WallUp() | |
63 | - | print(height) |
63 | + | |
64 | height = height + 1 | |
65 | if blockCount == 0 then | |
66 | findBlock() | |
67 | end | |
68 | turtle.placeDown() | |
69 | blockCount = blockCount - 1 | |
70 | ||
71 | end | |
72 | ||
73 | -- define wall block | |
74 | ||
75 | turtle.select(1) | |
76 | ||
77 | ||
78 | -- start | |
79 | ||
80 | while turns < 4 do | |
81 | ||
82 | while distance ~= maxdistance do | |
83 | ||
84 | if height ~= maxheight then | |
85 | WallUp() | |
86 | ||
87 | else | |
88 | ||
89 | t.forward() | |
90 | distance = distance + 1 | |
91 | while height ~= 0 do | |
92 | t.down() | |
93 | height = height - 1 | |
94 | end | |
95 | ||
96 | end | |
97 | ||
98 | end | |
99 | turtle.turnRight() | |
100 | turns = turns + 1 | |
101 | distance = 1 | |
102 | end |