View difference between Paste ID: Wx88xXBk and 22qxLei3
SHOW: | | - or go back to the newest paste.
1-
while true do 
1+
--THINGS TO ADD: Fuel meter, auto startup, "connect to turtle" - which wakes the turtle?
2
3-
  side = "top"
3+
local isRunning = true
4
5
function Quit()
6
        isRunning = false
7
        term.setCursorPos(1,1)
8
        term.setBackgroundColour(colours.black)
9-
  print("Welcome to turtle control!")
9+
        term.setTextColour(colours.white)
10
        term.clear()
11-
  paintutils.drawFilledBox(2,2,16,5,colors.yellow)
11+
		error()
12-
  paintutils.drawFilledBox(19,2,32,5,colors.yellow)
12+
end
13-
  paintutils.drawFilledBox(2,7,16,10,colors.yellow)
13+
14-
  paintutils.drawFilledBox(19,7,32,10,colors.yellow)
14+
local function getModem()
15-
  paintutils.drawFilledBox(2,12,16,15,colors.yellow)
15+
  for a,b in pairs(rs.getSides()) do
16-
  paintutils.drawFilledBox(19,12,32,15,colors.yellow)
16+
    if peripheral.getType(b) == "modem" and peripheral.call(b,"isWireless") then
17-
  term.setCursorPos(6,3)
17+
      return b
18
    end
19-
  term.setCursorPos(21,3)
19+
20-
  print("Backwards")
20+
end
21-
  term.setCursorPos(6,8)
21+
22
while isRunning do 
23-
  term.setCursorPos(21,8)
23+
24
  side = getModem()
25-
  term.setCursorPos(6,13)
25+
26-
  print("Turn Left")
26+
27-
  term.setCursorPos(21,13)
27+
28-
  print("Turn Right")
28+
29
  term.setTextColor(colors.blue)
30
  print("Turtle Control")
31-
    if x == 2 and y == 2 or x == 16 and y == 5 or x > 2 and x < 16 and y > 2 and y < 5 then
31+
32
  paintutils.drawFilledBox(2,2,10,5,colors.yellow) -- Forward
33
  paintutils.drawFilledBox(16,2,24,5,colors.yellow) -- Backward
34
  paintutils.drawFilledBox(2,7,10,10,colors.yellow) -- Left
35-
    elseif x == 19 and y == 2 or x == 32 and y == 5 or x > 19 and x < 32 and y > 2 and y < 5 then
35+
  paintutils.drawFilledBox(16,7,24,10,colors.yellow) -- Right
36
  paintutils.drawFilledBox(2,12,10,15,colors.yellow) -- Turn Left
37
  paintutils.drawFilledBox(16,12,24,15,colors.yellow) -- Turn Right
38
  paintutils.drawFilledBox(2,18,10,20,colors.yellow) -- Action
39-
    elseif x == 2 and y == 7 or x == 16 and y == 10 or x > 2 and x < 16 and y > 7 and y < 10 then
39+
  paintutils.drawFilledBox(16,18,24,20,colors.red) -- Exit
40
  term.setCursorPos(3,4)
41
  print("Forward")
42
  term.setCursorPos(16,4)
43-
    elseif x == 19 and y == 7 or x == 32 and y == 10 or x > 19 and x < 32 and y > 7 and y < 10 then
43+
  print("Backward")
44
  term.setCursorPos(4,9)
45
  print("Left")
46
  term.setCursorPos(18,9)
47-
    elseif x == 2 and y == 12 or x == 16 and y == 17 or x > 2 and x < 16 and y > 12 and y < 17 then
47+
48
  term.setCursorPos(4,13)
49
  print("Turn")
50
  term.setCursorPos(4,14)
51-
    elseif x == 19 and y == 12 or x == 32 and y == 17 or x > 19 and x < 32 and y > 12 and y < 17 then
51+
52
  term.setCursorPos(18,13)
53
  print("Turn")
54
  term.setCursorPos(18,14)
55
  print("Right")
56
  term.setCursorPos(4,19)
57
  print("Action")
58
  term.setCursorPos(18,19)
59
  print("Quit")
60
  while notclicked do
61
    event,button,x,y = os.pullEvent("mouse_click")
62
    if x == 2 and y == 2 or x == 10 and y == 5 or x > 2 and x < 10 and y > 2 and y < 5 then
63
      rednet.open(side)
64
      rednet.broadcast("forward")
65
      rednet.close(side)
66
    elseif x == 16 and y == 2 or x == 24 and y == 5 or x > 16 and x < 24 and y > 2 and y < 5 then
67
      rednet.open(side)
68
      rednet.broadcast("backwards")
69
      rednet.close(side)
70
    elseif x == 2 and y == 7 or x == 10 and y == 10 or x > 2 and x < 10 and y > 7 and y < 10 then
71
      rednet.open(side)
72
      rednet.broadcast("left")
73
      rednet.close(side)
74
    elseif x == 16 and y == 7 or x == 24 and y == 10 or x > 16 and x < 24 and y > 7 and y < 10 then
75
      rednet.open(side)
76
      rednet.broadcast("right")
77
      rednet.close(side)
78
    elseif x == 2 and y == 12 or x == 10 and y == 15 or x > 2 and x < 10 and y > 12 and y < 15 then
79
      rednet.open(side)
80
      rednet.broadcast("turnleft")
81
      rednet.close()
82
    elseif x == 16 and y == 12 or x == 24 and y == 15 or x > 16 and x < 24 and y > 12 and y < 15 then
83
      rednet.open(side)
84
      rednet.broadcast("turnright")
85
      rednet.close()
86
 	elseif x == 2 and y == 18 or x == 10 and y == 20 or x > 2 and x < 10 and y > 18 and y < 20 then
87
      rednet.open(side)
88
      rednet.broadcast("action")
89
      rednet.close()
90
    elseif x == 16 and y == 18 or x == 24 and y == 20 or x > 16 and x < 24 and y > 18 and y < 20 then
91
      rednet.open(side)
92
      rednet.broadcast("quit")
93
      rednet.close()
94
	  Quit()
95
    end
96
  end
97
end