View difference between Paste ID: u82FCEJc and 8LKYW1Ry
SHOW: | | - or go back to the newest paste.
1
-- 1 wide, 2 tall Advanced monitor on top of Advanced Computer. Bundled cable or MFR rednet cable out of bottom of Computer.
2
-- Based on placing in a Normal temp biome.
3-
-- Colour channels:
3+
-- Redstone strenghts:
4-
-- White: Power switch(Energy cells or similar) to heaters required to reach "Warm" level(4 heaters in my case).
4+
-- 2: Power switch(Energy cells or similar) to heaters required to reach "Warm" level(4 heaters in my case).
5-
-- Orange: Power switch for heaters which in addition to White is required to reach "Hot" level (4 heaters in my case, 8 heaters total)
5+
-- 3: Power switch for heaters required to reach "Hot" level (4 heaters in my case, 8 heaters total)
6-
-- Magenta: Power switch for Alveary Fans required to reach "Cold" level(2 fans in my case).
6+
-- 1: Power switch for Alveary Fans required to reach "Cold" level(2-3 fans in my case).
7
8
mouseWidth = 0
9
mouseHeight = 0
10
11
monitor = peripheral.wrap("top")
12
13
monitor.clear()
14
15
16
monitor.setCursorPos(1,1)
17
18
w,h=monitor.getSize()
19
20
print(w)
21
print(h)
22
23
-- Draw buttons
24
monitor.setCursorPos(1,2)
25
monitor.write("Alveary")
26
monitor.setCursorPos(1,3)
27
monitor.write(" Temp.")
28
29
monitor.setBackgroundColour((colours.green))
30
monitor.setCursorPos(1,5)
31
monitor.write("  HOT  ")
32
33
monitor.setBackgroundColour((colours.green))
34
monitor.setCursorPos(1,7)
35
monitor.write(" WARM  ")
36
37
monitor.setBackgroundColour((colours.lime))
38
monitor.setCursorPos(1,9)
39
monitor.write("NORMAL ")
40
41
monitor.setBackgroundColour((colours.green))
42
monitor.setCursorPos(1,11)
43
monitor.write(" COLD  ")
44
45
monitor.setBackgroundColour((colours.black))
46
47
48
49
-- Check click function
50
51
function checkClickPosition()
52
  if mouseWidth > 1 and mouseWidth < 7 and mouseHeight == 5 then
53
    -- button HOT clicked
54
	monitor.setBackgroundColour((colours.lime))
55
	monitor.setCursorPos(1,5)
56
	monitor.write("  HOT  ")
57
58
	monitor.setBackgroundColour((colours.green))
59
	monitor.setCursorPos(1,7)
60
	monitor.write(" WARM  ")
61
62
	monitor.setBackgroundColour((colours.green))
63
	monitor.setCursorPos(1,9)
64
	monitor.write("NORMAL ")
65
66
	monitor.setBackgroundColour((colours.green))
67
	monitor.setCursorPos(1,11)
68
	monitor.write(" COLD  ")
69
70
	monitor.setBackgroundColour((colours.black))
71
72-
    	redstone.setBundledOutput("bottom", colours.white+colours.orange)
72+
    	--redstone.setBundledOutput("bottom", colours.white+colours.orange)
73
	redstone.setAnalogOutput("bottom", 3)
74
	sleep(1)
75
  elseif mouseWidth > 1 and mouseWidth < 7 and mouseHeight == 7 then
76
    -- button WARM clicked
77
	monitor.setBackgroundColour((colours.green))
78
	monitor.setCursorPos(1,5)
79
	monitor.write("  HOT  ")
80
81
	monitor.setBackgroundColour((colours.lime))
82
	monitor.setCursorPos(1,7)
83
	monitor.write(" WARM  ")
84
85
	monitor.setBackgroundColour((colours.green))
86
	monitor.setCursorPos(1,9)
87
	monitor.write("NORMAL ")
88
89
	monitor.setBackgroundColour((colours.green))
90
	monitor.setCursorPos(1,11)
91
	monitor.write(" COLD  ")
92
93
	monitor.setBackgroundColour((colours.black))
94-
      	redstone.setBundledOutput("bottom",colours.white)
94+
95
      	--redstone.setBundledOutput("bottom",colours.white)
96
	redstone.setAnalogOutput("bottom", 2)
97
	sleep(1)
98
  elseif mouseWidth > 1 and mouseWidth < 7 and mouseHeight == 9 then
99
    -- button NORMAL clicked
100
	monitor.setBackgroundColour((colours.green))
101
	monitor.setCursorPos(1,5)
102
	monitor.write("  HOT  ")
103
104
	monitor.setBackgroundColour((colours.green))
105
	monitor.setCursorPos(1,7)
106
	monitor.write(" WARM  ")
107
108
	monitor.setBackgroundColour((colours.lime))
109
	monitor.setCursorPos(1,9)
110
	monitor.write("NORMAL ")
111
112
	monitor.setBackgroundColour((colours.green))
113
	monitor.setCursorPos(1,11)
114
	monitor.write(" COLD  ")
115
116-
      	redstone.setBundledOutput("bottom",0)
116+
117
118
      	--redstone.setBundledOutput("bottom",0)
119
	redstone.setAnalogOutput("bottom", 0)
120
	sleep(1)
121
  elseif mouseWidth > 1 and mouseWidth < 7 and mouseHeight == 11 then
122
    -- button COLD clicked
123
	monitor.setBackgroundColour((colours.green))
124
	monitor.setCursorPos(1,5)
125
	monitor.write("  HOT  ")
126
127
	monitor.setBackgroundColour((colours.green))
128
	monitor.setCursorPos(1,7)
129
	monitor.write(" WARM  ")
130
131
	monitor.setBackgroundColour((colours.green))
132
	monitor.setCursorPos(1,9)
133
	monitor.write("NORMAL ")
134
135
	monitor.setBackgroundColour((colours.lime))
136
	monitor.setCursorPos(1,11)
137
	monitor.write(" COLD  ")
138-
      	redstone.setBundledOutput("bottom",colours.magenta)
138+
139
	monitor.setBackgroundColour((colours.black))
140
141
      	--redstone.setBundledOutput("bottom",colours.magenta)
142
	redstone.setAnalogOutput("bottom", 1)
143-
redstone.setBundledOutput("bottom",0)
143+
144
  end
145
end
146
147
--redstone.setBundledOutput("bottom",0)
148
redstone.setAnalogOutput("bottom", 0)
149
150
151
repeat 
152
  	event,p1,p2,p3 = os.pullEvent()
153
   		if event=="monitor_touch" then
154
     			mouseWidth = p2 -- sets mouseWidth 
155
     			mouseHeight = p3 -- and mouseHeight 
156
     			checkClickPosition() -- this runs our function
157
   		end
158
until event=="char" and p1==("x")