View difference between Paste ID: RbhA7dw7 and gVUPTwyQ
SHOW: | | - or go back to the newest paste.
1
function RCT()
2
 while true do
3
  local scrap, msg = rednet.receive()
4
  if msg == "RCF" then
5
   if turtle.detect() == false then
6
    turtle.forward()
7
   end
8
  elseif msg == "RCMF" then
9
   if turtle.detect() then
10
    turtle.dig()
11
   end
12
  elseif msg == "RCGF" then
13
   if turtle.detect() then
14
    turtle.dig()
15
   end
16
   turtle.forward()
17
  elseif msg == "RCPF" then
18
   if turtle.detect() == false then
19
    turtle.place()
20
   end
21
  elseif msg == "RCAF" then
22
   turtle.attack()
23
  elseif msg == "RCB" then
24
   turtle.back()
25
  elseif msg == "RCL" then
26
   turtle.turnLeft()
27
  elseif msg == "RCR" then
28
   turtle.turnRight()
29
  elseif msg == "RCU" then
30
   if turtle.detectUp() == false then
31
    turtle.up()
32
   end
33
  elseif msg == "RCMU" then
34
   if turtle.detectUp() then
35
    turtle.digUp()
36
   end
37
  elseif msg == "RCGU" then
38
   if turtle.detectUp() then
39
    turtle.digUp()
40
   end
41
   turtle.up()
42
  elseif msg == "RCPU" then
43
   if turtle.detectUp() ==false then
44
    turtle.placeUp()
45
   end
46
  elseif msg == "RCAU" then
47
   turtle.attackUp()
48
  elseif msg == "RCD" then
49
   if turtle.detectDown() == false then
50
    turtle.down()
51
   end
52
  elseif msg == "RCMD" then
53
   if turtle.detectDown() then
54
    turtle.digDown()
55
   end
56
  elseif msg == "RCGD" then
57
   if turtle.detectDown() then
58
    turtle.digDown()
59
   end
60
   turtle.down()
61
  elseif msg == "RCPD" then
62
   if turtle.detectDown() == false then
63
    turtle.placeDown()
64
   end
65
  elseif msg == "RCAD" then
66
   turtle.attackDown()
67
  elseif msg == "RC1" then
68
   turtle.select(1)
69
  elseif msg == "RC2" then
70
   turtle.select(2)
71
  elseif msg == "RC3" then
72
   turtle.select(3)
73
  elseif msg == "RC4" then
74
   turtle.select(4)
75
  elseif msg == "RC5" then
76
   turtle.select(5)
77
  elseif msg == "RC6" then
78
   turtle.select(6)
79
  elseif msg == "RC7" then
80
   turtle.select(7)
81
  elseif msg == "RC8" then
82
   turtle.select(8)
83
  elseif msg == "RCRF" then
84
   if turtle.getItemCount(16) == 0 then
85
    rednet.broadcast("RFNF")
86-
    --(Add): Send message to computer: No fuel available!
86+
87-
   elseif turtle.getItemCount(16) > 0 then
87+
   else
88
    if turtle.getFuelLevel() > 64 then
89
     sleep(0)
90-
     --(ADD): Send to computer: No need to refuel!
90+
     rednet.broadcast("RFF")
91-
    elseif turtle.getFuelLevel() < 64 then
91+
    else
92
     turtle.select(16)
93
     if turtle.refuel(0) == false then
94-
      --(ADD): Send to computer: Item in slot 16 is not a valid fuel!
94+
95-
     elseif turtle.refuel(0) == true then
95+
      rednet.broadcast("RFNV")
96-
      turtle.refuel(16)
96+
     else
97-
      --(ADD): Send to computer: Refuel successful!
97+
      turtle.select(16)
98
      turtle.refuel(1)
99
      rednet.broadcast("RFS")
100
     end
101
     turtle.select(1)
102
    end
103
   end
104
  end
105
 end
106
end
107
108
rednet.open("right")
109
term.clear()
110
term.setCursorPos(1,1)
111
print[[Remote Controlled Turtle Initiated!
112
 - This turtle is being controlled from a remote location
113
Program by 44shades44]]
114
115
RCT()