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