View difference between Paste ID: dRyDmQV2 and 9pRPGTss
SHOW: | | - or go back to the newest paste.
1
-- Made By HDR @MartinRefseth
2-
sleep(0.2)
2+
button = require("buttonAPI") 
3-
os.loadAPI("button")
3+
local event = require("event")
4-
for a,b in pairs(rs.getSides()) do
4+
local computer = require("computer")
5-
  if peripheral.getType(b) == 'monitor' then
5+
local term = require("term")
6-
   mon = peripheral.wrap(b)
6+
local component = require("component")
7-
   break
7+
local gpu = component.gpu
8
9
 
10
-- Functions/Buttons
11
function fillTable()
12
   button.setTable("13", Thir, 2,12,3,5)
13
   button.setTable("Cat", Cat, 14,24,3,5)
14
   button.setTable("Blocks", Blocks, 26,36,3,5)
15
   button.setTable("Chirp", Chirp, 38,48,3,5)
16
   button.setTable("Far", Far, 50,60,3,5)
17
   button.setTable("Mall", Mall, 2,12,7,9)
18
   button.setTable("Mellohi", Mellohi, 14,24,7,9)    
19
   button.setTable("Stal", Stal, 26,36,7,9)
20
   button.setTable("Strad", Strad, 38,48,7,9)
21
   button.setTable("Ward", Ward, 50,60,7,9)
22
   button.setTable("11", Elev, 2,12,11,13)
23
   button.setTable("Wait", Wait, 14,24,11,13)
24
   button.setTable("???", Question, 26,36,11,13)
25
   button.setTable("Gaia 1", GaiaOne, 38,48,11,13)
26
   button.setTable("Gaia 2", GaiaTwo, 50,60,11,13)
27
   button.setTable("Still Alive", Slive, 20,30,15,17)
28
   button.setTable("Radio Loop", Roop, 8,18,15,17)
29
   button.setTable("Want You", WYG, 32,42,15,17)
30
   button.setTable("Wanderer", Wander, 44,54,15,17)  
31
   button.setTable("Stop", Stop, 20,30,19,20)
32
   button.setTable("Reboot", Reboot, 32,42,19,20)
33
   button.screen()
34
end
35
 
36
function getClick()
37
  local _, _, x, y = event.pull(1,touch)
38
  if x == nil or y == nil then
39-
   event,side,x,y = os.pullEvent("monitor_touch")
39+
    local h, w = gpu.getResolution()
40-
   button.checkxy(x,y)
40+
    gpu.set(h, w, ".")
41
    gpu.set(h, w, " ")
42
  else
43
    button.checkxy(x,y)
44
  end
45
end
46
 
47
-- Functions
48
function Thir()
49
   button.flash("13")
50
   print("Loading 13")
51
 local title = "C418 - 13"
52
 peripheral.find("drive", disk.stopAudio)
53
 peripheral.find( "drive", function( name )
54
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
55
    disk.playAudio( name )
56
  end
57
 end )
58
end
59
 
60
function Cat()
61
   button.flash("Cat")
62
   print("Loading Cat")
63
 local title = "C418 - cat"
64
 peripheral.find("drive", disk.stopAudio)
65
 peripheral.find( "drive", function( name )
66
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
67
    disk.playAudio( name )
68
  end
69
 end )
70
end
71
 
72
function Blocks()
73
   button.flash("Blocks")
74
   print("Loading Blocks")
75
   peripheral.find("drive", disk.stopAudio)
76
 local title = "C418 - blocks"
77
 peripheral.find("drive", disk.stopAudio)
78
 peripheral.find( "drive", function( name )
79
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
80
    disk.playAudio( name )
81
  end
82
 end )
83
end  
84
 
85
function Chirp()
86
   button.flash("Chirp")
87
   print("Loading Chirp")
88
   peripheral.find("drive", disk.stopAudio)
89
 local title = "C418 - chirp"
90
 peripheral.find("drive", disk.stopAudio)
91
 peripheral.find( "drive", function( name )
92
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
93
    disk.playAudio( name )
94
  end
95
 end )
96
end  
97
 
98
function Far()
99
   button.flash("Far")
100
   print("Loading Far")
101
   peripheral.find("drive", disk.stopAudio)
102
 local title = "C418 - far"
103
 peripheral.find("drive", disk.stopAudio)
104
 peripheral.find( "drive", function( name )
105
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
106
    disk.playAudio( name )
107
  end
108
 end )
109
end
110
 
111
function Mall()
112
   button.flash("Mall")
113
   print("Loading Mall")
114
   peripheral.find("drive", disk.stopAudio)
115
 local title = "C418 - mall"
116
 peripheral.find("drive", disk.stopAudio)
117
 peripheral.find( "drive", function( name )
118
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
119
    disk.playAudio( name )
120
  end
121
 end )
122
end
123
 
124
function Mellohi()
125
   button.flash("Mellohi")
126
   print("Loading Mellohi")
127
   peripheral.find("drive", disk.stopAudio)
128
 local title = "C418 - mellohi"
129
 peripheral.find("drive", disk.stopAudio)
130
 peripheral.find( "drive", function( name )
131
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
132
    disk.playAudio( name )
133
  end
134
 end )
135
end
136
 
137
function Stal()
138
   button.flash("Stal")
139
   print("Loading Stal")
140
   peripheral.find("drive", disk.stopAudio)
141
 local title = "C418 - stal"
142
 peripheral.find("drive", disk.stopAudio)
143
 peripheral.find( "drive", function( name )
144
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
145
    disk.playAudio( name )
146
  end
147
 end )
148
end
149
 
150
function Strad()
151
   button.flash("Strad")
152
   print("Loading Strad")
153
   peripheral.find("drive", disk.stopAudio)
154
 local title = "C418 - strad"
155
 peripheral.find("drive", disk.stopAudio)
156
 peripheral.find( "drive", function( name )
157
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
158
    disk.playAudio( name )
159
  end
160
 end )
161
end
162
   
163
function Ward()
164
   button.flash("Ward")
165
   print("Loading Ward")
166
   peripheral.find("drive", disk.stopAudio)
167
 local title = "C418 - ward"
168
 peripheral.find("drive", disk.stopAudio)
169
 peripheral.find( "drive", function( name )
170
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
171
    disk.playAudio( name )
172
  end
173
 end )
174
end
175
 
176
function Elev()
177
   button.flash("11")
178
   print("Loading 11")
179
   peripheral.find("drive", disk.stopAudio)
180
 local title = "C418 - 11"
181
 peripheral.find("drive", disk.stopAudio)
182
 peripheral.find( "drive", function( name )
183
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
184
    disk.playAudio( name )
185
  end
186
 end )
187
end
188
 
189
function Wait()
190
   button.flash("Wait")
191
   print("Loading Wait")
192
   peripheral.find("drive", disk.stopAudio)
193
 local title = "C418 - wait"
194
 peripheral.find("drive", disk.stopAudio)
195
 peripheral.find( "drive", function( name )
196
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
197
    disk.playAudio( name )
198
  end
199
 end )
200
end
201
 
202
function Question()
203
   button.flash("???")
204
   print("Loading ???")
205
   peripheral.find("drive", disk.stopAudio)
206
 local title = "corruption"
207
 peripheral.find("drive", disk.stopAudio)
208
 peripheral.find( "drive", function( name )
209
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
210
    disk.playAudio( name )
211
  end
212
 end )
213
end
214
 
215
function GaiaOne()
216
   button.flash("Gaia 1")
217
   print("Loading Gaia 1")
218
   peripheral.find("drive", disk.stopAudio)
219
 local title = "botania:gaia1"
220
 peripheral.find("drive", disk.stopAudio)
221
 peripheral.find( "drive", function( name )
222
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
223
    disk.playAudio( name )
224
  end
225
 end )
226
end
227
 
228
function GaiaTwo()
229
   button.flash("Gaia 2")
230
   print("Loading Gaia 2")
231
   peripheral.find("drive", disk.stopAudio)
232
 local title = "botania:gaia2"
233
 peripheral.find("drive", disk.stopAudio)
234
 peripheral.find( "drive", function( name )
235
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
236
    disk.playAudio( name )
237
  end
238
 end )
239
end
240
 
241
function Roop()
242
   button.flash("Radio Loop")
243
   print("Loading Radio Loop")
244
   peripheral.find("drive", disk.stopAudio)
245
 local title = "portalgun:records.radioloop"
246
 peripheral.find("drive", disk.stopAudio)
247
 peripheral.find( "drive", function( name )
248
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
249
    disk.playAudio( name )
250
  end
251
 end )
252
end
253
 
254
function Slive()
255
   button.flash("Still Alive")
256
   print("Loading Still Alive")
257
   peripheral.find("drive", disk.stopAudio)
258
 local title = "portalgun:records.stillalive"
259
 peripheral.find("drive", disk.stopAudio)
260
 peripheral.find( "drive", function( name )
261
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
262
    disk.playAudio( name )
263
  end
264
 end )
265
end
266
 
267
function WYG()
268
   button.flash("Want You")
269
   print("Loading Want You Gone")
270
   peripheral.find("drive", disk.stopAudio)
271
 local title = "portalgun:records.wantyougone"
272
 peripheral.find("drive", disk.stopAudio)
273
 peripheral.find( "drive", function( name )
274
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
275
    disk.playAudio( name )
276
  end
277
 end )
278
end
279
 
280
function Wander()
281
    button.flash("Wanderer")
282
    print("Loading Wanderer")
283
    peripheral.find("drive", disk.stopAudio)
284
 local title = "wanderer"
285
 peripheral.find("drive", disk.stopAudio)
286
 peripheral.find( "drive", function( name )
287
  if disk.hasAudio( name ) and disk.getAudioTitle( name ) == title then
288
    disk.playAudio( name )
289
  end
290
 end )
291
end
292
 
293
function Stop()
294
   button.flash("Stop")
295
   print("Stopping Disk")
296
   peripheral.find("drive", disk.stopAudio)
297
end
298-
   mon.clear()
298+
299-
   os.reboot()
299+
300
   print("Rebooting")
301
   --peripheral.find("drive", disk.stopAudio)
302-
local greeting = "HDR's Music System V1.5"
302+
   computer.shutdown(true)
303
end
304
305
term.setCursorBlink(false)
306
gpu.setResolution(61, 20)
307
button.clear()
308
-- Heading      
309
local greeting = "HDR's Music System V1.0Dev"
310
 
311
fillTable()
312
button.heading(greeting)
313
 
314
while true do
315
   getClick()
316
end