View difference between Paste ID: xZHdBdxn and SC7E3bEk
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("button") 
2
m=peripheral.wrap("left")
3
rednet.open("back")
4-
m.clear()
4+
local sheepon = false
5
local sugaron = false
6
local digon = false
7-
   button.heading("--------- BaseControl v1.0 ---------")
7+
local xpon = false
8
local meaton = false
9
10
function drawHeading()
11-
   button.setTable("Sheep on",sheepon,3,13,3,5)
11+
   button.heading("--------- BaseControl v2.0 ---------")
12-
   button.setTable("Sheep off",sheepoff,16,26,3,5)
12+
13-
   button.setTable("Sugar on",sugaron,3,13,8,10)
13+
14-
   button.setTable("Sugar off",sugaroff,16,26,8,10)
14+
15-
   button.setTable("DigRig on",digon,30,40,3,5)
15+
   button.setTable("Toggle Sheep",sheep,3,16,6,10)
16-
   button.setTable("DigRig off",digoff,43,53,3,5)
16+
   button.setTable("Toggle Sugar",sugar,19,32,6,10)
17-
   button.setTable("XP on",xpon,30,40,8,10)
17+
   button.setTable("Toggle Dig",dig,35,48,6,10)
18-
   button.setTable("XP off",xpoff,43,53,8,10)
18+
   button.setTable("Toggle XP",xp,51,64,6,10)
19-
   button.setTable("Meat on",meaton,57,67,3,5)
19+
   button.setTable("Toggle Meat",meat,67,80,6,10)
20-
   button.setTable("Meat off",meatoff,70,80,3,5)
20+
21
end
22
23
function drawText()
24
   button.label(3,3,"Sheep farm:")
25-
   --button.label(x,y,"Sheep farm:")
25+
   button.label(19,3,"Sugar farm:")
26-
   --button.label(x,y,"Sugar Cane farm:")
26+
   button.label(35,3,"Digging Rig:")
27-
   --button.label(x,y,"Digging Rig:")
27+
   button.label(51,3,"XP Farm:")
28-
   --button.label(x,y,"XP Farm:")
28+
   button.label(67,3,"Meat Farm:")
29-
   --button.label(x,y,"Meat Farm:")
29+
30
end
31
32
function drawStatus()
33-
function sheepon()
33+
   if sheepon then
34-
   button.flash("Sheep on")
34+
      button.label(3,4,"active")
35-
   shell.run("redset","right","yellow","true")
35+
   else
36
      button.label(3,4,"inactive")
37
   end
38-
function sheepoff()
38+
   if sugaron then
39-
   button.flash("Sheep off")
39+
      button.label(19,4,"active")
40-
   shell.run("redset","right","yellow","false")
40+
   else
41
      button.label(19,4,"inactive")
42
   end
43-
function sugaron()
43+
   if digon then
44-
   button.flash("Sugar on")
44+
      button.label(35,4,"active")
45-
   shell.run("redset","right","red","true")
45+
   else
46
      button.label(35,4,"inactive")
47
   end
48-
function sugaroff()
48+
   if xpon then
49-
   button.flash("Sugar off")
49+
      button.label(51,4,"active")
50-
   shell.run("redset","right","red","false")
50+
   else
51
      button.label(51,4,"inactive")
52
   end
53-
function digon()
53+
   if meaton then
54-
   button.flash("DigRig on")
54+
      button.label(67,4,"active")
55-
   shell.run("redset","right","green","true")
55+
   else
56
      button.label(67,4,"inactive")
57
   end
58-
function digoff()
58+
59-
   button.flash("DigRig off")
59+
60-
   shell.run("redset","right","green","false")
60+
function drawScreen()
61
   m.clear()
62
   drawHeading()
63-
function xpon()
63+
   drawText()
64-
   button.flash("XP on")
64+
   drawButtons()
65-
   shell.run("redset","right","blue","false")
65+
   drawStatus()
66
end
67
68-
function xpoff()
68+
function sheep()
69-
   button.flash("XP off")
69+
   button.flash("Toggle Sheep")
70-
   shell.run("redset","right","blue","true")
70+
   sheepon = not sheepon
71
   if sheepon then
72
      shell.run("redset","right","yellow","true")
73-
function meaton()
73+
   else
74-
   if meatactive == "inactive" then
74+
      shell.run("redset","right","yellow","false")
75-
      button.toggleButton("Meat on")
75+
76
end
77
78-
      meatactive = "active"
78+
function sugar()
79-
      button.toggleButton("Meat on")
79+
   button.flash("Toggle Sugar")
80
   sugaron = not sugaron
81
   if sugaron then
82
      shell.run("redset","right","red","true")
83-
function meatoff()
83+
   else
84-
   if meatactive == "active" then
84+
      shell.run("redset","right","red","false")
85-
     button.toggleButton("Meat off")
85+
86
end
87
88-
     button.toggleButton("Meat off")
88+
function dig()
89-
     meatactive = "inactive"
89+
   button.flash("Toggle Dig")
90
   digon = not digon
91
   if digon then
92
      shell.run("redset","right","green","true")
93
   else
94
      shell.run("redset","right","green","false")
95
   end
96
end
97
98-
drawHeading()
98+
function xp()
99-
drawText()
99+
   button.flash("Toggle XP")
100-
drawButtons()
100+
   xpon = not xpon
101
   if xpon then
102
      shell.run("redset","right","blue","false")
103
   else
104
      shell.run("redset","right","blue","true")
105
   end
106
end
107
108
function meat()
109
   meaton = not meaton
110
   if meaton then
111
      button.toggleButton("Toggle Meat")
112
      shell.run("sendmsg","89","place")
113
      id,msg,dist = rednet.receive()
114
      button.toggleButton("Toggle Meat")
115
   else
116
     button.toggleButton("Toggle Meat")
117
     shell.run("sendmsg","89","remove")
118
     id,msg,dist = rednet.receive()
119
     button.toggleButton("Toggle Meat")
120
   end
121
end
122
123
function getClick()
124
   event,side,x,y = os.pullEvent("monitor_touch")
125
   button.checkxy(x,y)
126
end
127
128
drawScreen()
129
shell.run("redset","right","blue","true")
130
shell.run("sendmsg","89","remove")
131
while true do
132
   getClick()
133
   drawScreen()
134
end