View difference between Paste ID: r1jHcEmV and eujN371S
SHOW: | | - or go back to the newest paste.
1
--Use this program with Steve's Factory Manager
2
--Chargement API
3
os.loadAPI("button")
4
 
5
--Prog:
6
rsSide = "bottom"
7
m = peripheral.wrap("top")
8
rsMob = {["EnderMen"] = 1,
9
         ["Blaze"] = 2,
10
         ["Pnj"] = 3,
11
         ["Kill"] = 15} 
12
13
function fillTable()
14
 button.setTable("EnderMen",ender,2,12,3,5)
15
 button.setTable("Blaze",blaze,15,25,3,5)
16
 button.setTable("PNJ",pnj,28,38,3,5)
17
 button.setTable("Kill",kill,15,25,7,9)
18
 button.screen()
19
end
20
 
21
function getClic()
22
 event,side,x,y = os.pullEvent("monitor_touch")
23
 button.checkxy(x,y)
24
end
25
 
26
--Prog passif:
27
 
28
active = false
29
30
function ender()
31
 button.toggleButton("EnderMen")
32
 active = not active
33
 if active then
34
  rs.setAnalogOutput(rsSide,rsMob["EnderMen"],true)
35
  print("EnderMen: "..tostring(active))
36
 else
37
  rs.setOutput(rsSide,false)
38
  print("EnderMen: "..tostring(active))
39
 end
40
end
41
 
42
--rsActiv = false
43
function blaze()
44
 button.toggleButton("Blaze")
45
 active = not active
46
 if active then
47
  rs.setAnalogOutput(rsSide,rsMob["Blaze"],true)
48
  print("Blaze: "..tostring(active))
49
 else
50
  rs.setOutput(rsSide,false)
51
  print("Blaze: "..tostring(active))
52
 end
53
end
54
 
55
function pnj()
56
 button.toggleButton("PNJ")
57
 active = not active
58
 if active then
59
  rs.setAnalogOutput(rsSide,rsMob["Pnj"],true)
60
  print("Pnj: "..tostring(active))
61
 else
62
  rs.setOutput(rsSide,false)
63
  print("Pnj: "..tostring(active))
64
 end
65
end
66
 
67
function kill()
68
 button.toggleButton("Kill")
69
 active = not active
70
 if active then
71
  rs.setAnalogOutput(rsSide,rsMob["Kill"],true)
72
  print("Kill: "..tostring(active))
73
 else
74
  rs.setOutput(rsSide,false)
75
  print("Kill: "..tostring(active))
76
 end
77
end
78
 
79
--Prog actif:
80
 
81
button.clearTable()
82-
button.heading("Mob Spawning Controller")
82+
83
button.heading("Mob Spawning Controler")
84
--button.label(1,4,"Tutoriel")
85
 
86
while true do
87
 getClic()
88
end