View difference between Paste ID: 0FM5hCx9 and XpyjPrDt
SHOW: | | - or go back to the newest paste.
1-
-- Made By HDR @MartinRefseth
1+
--# Made By HDR - @MartinRefseth #--
2-
sleep(0.2)
2+
--# Version 2.3 #--
3-
os.loadAPI("button")
3+
--# Thanks to Lyqyd for his Button API http://www.computercraft.info/forums2/index.php?/topic/14784-touchpoint-api/ #--
4
os.loadAPI("touchpoint")
5
for a,b in pairs(rs.getSides()) do
6
  if peripheral.getType(b) == 'monitor' then
7
   mon = peripheral.wrap(b)
8
   t = touchpoint.new(b)
9
   break
10
  end
11
end
12-
-- Functions/Buttons
12+
13-
function fillTable()
13+
--# Functions
14-
   button.setTable("13", Thir, 2,12,3,5)
14+
function play()
15-
   button.setTable("Cat", Cat, 14,24,3,5)
15+
16-
   button.setTable("Blocks", Blocks, 26,36,3,5)
16+
17-
   button.setTable("Chirp", Chirp, 38,48,3,5)
17+
18-
   button.setTable("Far", Far, 50,60,3,5)
18+
    print("Now Playing"," ",( title) )
19-
   button.setTable("Mall", Mall, 2,12,7,9)
19+
20-
   button.setTable("Mellohi", Mellohi, 14,24,7,9)    
20+
21-
   button.setTable("Stal", Stal, 26,36,7,9)
21+
22-
   button.setTable("Strad", Strad, 38,48,7,9)
22+
end  
23-
   button.setTable("Ward", Ward, 50,60,7,9)
23+
24-
   button.setTable("11", Elev, 2,12,11,13)
24+
25-
   button.setTable("Wait", Wait, 14,24,11,13)
25+
   t:flash("13")
26-
   button.setTable("???", Question, 26,36,11,13)
26+
   title = "C418 - 13"
27-
   button.setTable("Gaia 1", GaiaOne, 38,48,11,13)
27+
   play()
28-
   button.setTable("Gaia 2", GaiaTwo, 50,60,11,13)
28+
29-
   button.setTable("Still Alive", Slive, 20,30,15,17)
29+
30-
   button.setTable("Radio Loop", Roop, 8,18,15,17)
30+
31-
   button.setTable("Want You", WYG, 32,42,15,17)
31+
   t:flash("Cat")
32-
   button.setTable("Wanderer", Wander, 44,54,15,17)  
32+
   title = "C418 - cat"
33-
   button.setTable("Stop", Stop, 26,36,19,20)
33+
   play()
34-
   button.setTable("Reboot", Reboot, 38,48,19,20)
34+
35-
   button.setTable("Random", Random, 14,24,19,20)
35+
36-
   button.screen()
36+
37
   t:flash("Blocks")
38
   title = "C418 - blocks"
39-
function getClick()
39+
   play()
40-
   event,side,x,y = os.pullEvent("monitor_touch")
40+
end  
41-
   button.checkxy(x,y)
41+
42
function Chirp()
43
   t:flash("Chirp")
44-
-- Functions
44+
   title = "C418 - chirp"
45
   play()
46-
   button.flash("13")
46+
end  
47-
   print("Loading 13")
47+
48-
 local title = "C418 - 13"
48+
49
   t:flash("Far")
50
   title = "C418 - far"
51
   play()
52
end
53
 
54
function Mall()
55
   t:flash("Mall")
56
   title = "C418 - mall"
57
   play()
58-
   button.flash("Cat")
58+
59-
   print("Loading Cat")
59+
60-
 local title = "C418 - cat"
60+
61
   t:flash("Mellohi")
62
   title = "C418 - mellohi"
63
   play()
64
end
65
 
66
function Stal()
67
   t:flash("Stal")
68
   title = "C418 - stal"
69
   play()
70-
   button.flash("Blocks")
70+
71-
   print("Loading Blocks")
71+
72
function Strad()
73-
 local title = "C418 - blocks"
73+
   t:flash("Strad")
74
   title = "C418 - strad"
75
   play()
76
end
77
   
78
function Ward()
79
   t:flash("Ward")
80-
end   
80+
   title = "C418 - ward"
81
   play()
82
end
83-
   button.flash("Chirp")
83+
84-
   print("Loading Chirp")
84+
85
   t:flash("11")
86-
 local title = "C418 - chirp"
86+
   title = "C418 - 11"
87
   play()
88
end
89
 
90
function Wait()
91
   t:flash("Wait")
92
   title = "C418 - wait"
93-
end   
93+
   play()
94
end
95
 
96-
   button.flash("Far")
96+
--#Stops All Music
97-
   print("Loading Far")
97+
98
   t:flash("Stop")
99-
 local title = "C418 - far"
99+
100
   peripheral.find("drive", disk.stopAudio)
101
end
102
function Reboot()
103
   t:flash("Reboot")
104
   print("Rebooting")
105
   peripheral.find("drive", disk.stopAudio)
106
   mon.clear()
107
   os.reboot()
108
end
109-
   button.flash("Mall")
109+
110-
   print("Loading Mall")
110+
-- A list of all possible songs --# Thanks to http://pastebin.com/u/MechWipf for the Random function #--
111
local Songs = {
112-
 local title = "C418 - mall"
112+
113
    Elev, Wait, Question, GaiaOne, GaiaTwo, Roop, Slive, WYG, Wander
114
}
115
 
116
function Random()
117
    t:flash("Random")
118
    peripheral.find("drive", disk.stopAudio)
119
    local maxSongs = #Songs -- the "#" gets the length of the list
120
    local randomNumber = math.random( maxSongs )
121
    Songs[randomNumber]() -- call the choosen song directly out of the list
122-
   button.flash("Mellohi")
122+
123-
   print("Loading Mellohi")
123+
124
--#OverWrites Part Of Touchpoint API#--
125-
 local title = "C418 - mellohi"
125+
    t.draw = function(self)
126
      local function cT(text)
127
        x,y = term.getSize()
128
        x1,y1 = term.getCursorPos()
129
        term.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
130
        term.write(text)
131
     end
132
                local old = term.redirect(self.mon)
133
                term.setTextColor(colors.white)
134
                term.setBackgroundColor(colors.gray)
135-
   button.flash("Stal")
135+
                term.clear()
136-
   print("Loading Stal")
136+
                term.setCursorPos(1,1)
137
                term.setTextColor(colors.orange)
138-
 local title = "C418 - stal"
138+
                cT("HDR's Music System V2.3")
139
                for name, buttonData in pairs(self.buttonList) do
140
                        if buttonData.active then
141
                                term.setBackgroundColor(buttonData.activeColor)
142
                                term.setTextColor(buttonData.activeText)
143
                        else
144
                                term.setBackgroundColor(buttonData.inactiveColor)
145
                                term.setTextColor(buttonData.inactiveText)
146
                        end
147
                        for i = buttonData.yMin, buttonData.yMax do
148-
   button.flash("Strad")
148+
                                term.setCursorPos(buttonData.xMin, i)
149-
   print("Loading Strad")
149+
                                term.write(buttonData.label[i - buttonData.yMin + 1])
150
                        end
151-
 local title = "C418 - strad"
151+
                end
152
                if old then
153
                        term.redirect(old)
154
                else
155
                        term.restore()
156
                end
157
        end
158
159
--# Buttons
160
t:add("13", Thir, 3,3,13,5, colors.cyan, colors.lime, colors.orange, colors.orange)
161-
   button.flash("Ward")
161+
t:add("Cat", Cat, 15,3,25,5, colors.cyan, colors.lime, colors.orange, colors.orange)
162-
   print("Loading Ward")
162+
t:add("Blocks", Blocks, 27,3,37,5, colors.cyan, colors.lime, colors.orange, colors.orange)
163
t:add("Chirp", Chirp, 3,7,13,9, colors.cyan, colors.lime, colors.orange, colors.orange)
164-
 local title = "C418 - ward"
164+
t:add("Far", Far, 15,7,25,9, colors.cyan, colors.lime, colors.orange, colors.orange)
165
t:add("Mall", Mall, 27,7,37,9, colors.cyan, colors.lime, colors.orange, colors.orange)
166
t:add("Mellohi", Mellohi, 3,11,13,13, colors.cyan, colors.lime, colors.orange, colors.orange)
167
t:add("Stal", Stal, 15,11,25,13, colors.cyan, colors.lime, colors.orange, colors.orange)
168
t:add("Strad", Strad, 27,11,37,13, colors.cyan, colors.lime, colors.orange, colors.orange)
169
t:add("Ward", Ward, 3,15,13,17, colors.cyan, colors.lime, colors.orange, colors.orange)
170
t:add("11", Elev, 15,15,25,17, colors.cyan, colors.lime, colors.orange, colors.orange)
171
t:add("Wait", Wait, 27,15,37,17, colors.cyan, colors.lime, colors.orange, colors.orange)
172
t:add("Random", Random, 3,19,13,19, colors.cyan, colors.lime, colors.orange, colors.orange)
173
t:add("Stop", Stop, 15,19,25,19, colors.cyan, colors.lime, colors.orange, colors.orange)
174-
   button.flash("11")
174+
t:add("Reboot", Reboot, 27,19,37,19, colors.cyan, colors.lime, colors.orange, colors.orange)
175-
   print("Loading 11")
175+
t:run()