View difference between Paste ID: HXNrgiNR and DXsG7XYA
SHOW: | | - or go back to the newest paste.
1
-- Floor v2.0
2
3
term.clear()
4
term.setCursorPos(1,1)
5
print("Floor 2.0 by subzero22")
6
turtle.select(1)
7
print("This code was originally for a new version of CC. It has been edited for an older version to be used in tekkit and so it might have some bugs.")
8-
print("Put the item you want to build with in the bottom left slot.")
8+
9
--print("Put the item you want to build with in the bottom left slot.")
10-
print("How long do you want the foor to be?")
10+
11
12-
l = tonumber( read() )
12+
function long()
13
  print("How long do you want the foor to be?")
14
  write("> ")
15-
print("How wide do you want the floor to be?")
15+
  l = tonumber( read() )
16
  print()
17-
w = tonumber( read() )
17+
 if l then
18
 else
19
   print("Please enter a number.")
20
   return long()
21
 end
22
end
23
long()
24
25
function wide()
26
  print("How wide do you want the floor to be?")
27
  write("> ")
28
  w = tonumber( read() )
29
  print()
30
 if w then
31
 else
32
   print("Please enter a number")
33
   return wide()
34
 end
35
end
36
wide()
37
38
print("Build left or right?")
39-
  elseif s == 16 and turtle.getItemCount(16) >= 1 then
39+
40
left = string.lower(read())
41
print("")
42
43
print("would you like the turlte to dig the floor also? yes/no")
44
write("> ")
45
dig = string.lower(read())
46
print("")
47
48-
  elseif turtle.compareTo(16) == false then
48+
49
l = l - 1
50
turtle.select(s)
51
function check()
52
  if turtle.getItemCount(s) == 0 then
53
    s = s + 1
54
    turtle.select(s)
55
    sleep(0.2)
56
    check()
57
  elseif s == 9 and turtle.getItemCount(9) <= 1 then
58
    print("Turtle ran out of resources to build with")
59
    print("Please refill turtle with needed blocks and")
60
    print("press any key to continue building")
61-
      turtle.attackDown()
61+
62
    s = 1
63
    turtle.select(s)
64
    sleep(0.2)
65
    check()
66-
      turtle.attackDown()
66+
--[[  elseif turtle.compareTo(16) == false then
67
    s = s + 1
68
    turtle.select(s)
69
    sleep(0.2)
70
    check()
71-
    turtle.attack()
71+
]]
72
  end
73
end
74
75
function floor()
76
check()
77
  if dig == "yes" then
78
    while not turtle.placeDown() do
79
      turtle.digDown()
80
--      turtle.attackDown()
81
      sleep(0.1)
82
    end
83
  else
84
    while not turtle.placeDown() do
85
--      turtle.attackDown()
86
    end
87
  end
88
  while not turtle.forward() do
89
    turtle.dig()
90
--    turtle.attack()
91
    sleep(0.6)
92
  end
93
end
94
95
function turn()
96
if left == "left" then
97
turtle.turnLeft()
98
floor()
99
turtle.turnLeft()
100
left = "right"
101
else
102
turtle.turnRight()
103
floor()
104
turtle.turnRight()
105
left = "left"
106
end
107
end
108
109
for a=1,w do
110
for b=1,l do
111
floor()
112
end
113
turn()
114
end