Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- DJ Jocky
- Made by: willwac (NewCoolPC) & Zambonie (PAT457)
- This is a simple DJ program that doesn't use turtles
- At CCU2, turtles cannot be accessed by students,
- but we wanted a DJ system, so we made this!
- To use:
- 1: Place down 12 disk drives, and network them to
- the computer.
- 2: Edit the table below to match the drive numbers.
- 3: Edit the top bar text if you wish.
- 4: Save, and run DJ Jocky, make sure it works.
- 5: Rename DJ Jocky to "startup".
- 6: +1, comment, and suscribe to the forum thread
- if you wish.
- 7: Talk about CCU2 if you wish.
- 8: Give us feedback, and please, please report bugs
- 9: After you've done the above, listen to some
- great tunes!
- --]]
- local function menu()
- end
- local tracks = {
- --[[
- Format:
- ["SONG"] = {lengthInSeconds_num, "diskDriveNumber_string",yPos_num, orderIDLeaveAlone_num}
- --]]
- ["13"] = { 178, "11",3,1 },
- ["cat"] = { 185, "12",4,2 },
- ["blocks"] = { 13500, "13",5,3 },
- ["chirp"] = { 185, "14",6,4 },
- ["far"] = { 174, "15",7,5 },
- ["mall"] = { 197, "16",8,6 },
- ["mellohi"] = { 96, "22",9,7 },
- ["stal"] = { 150, "21",10,8 },
- ["strad"] = { 188, "17",11,9 },
- ["ward"] = { 251, "18",12,10 },
- ["11"] = { 71, "20",13,11 },
- ["wait"] = { 230, "19",14,12 }
- }
- local size = { term.getSize() }
- term.setBackgroundColor( colors.lightGray )
- term.clear()
- paintutils.drawLine( 1, 1, size[1], 1, colors.gray )
- term.setCursorPos( 2, 1 )
- term.setTextColor( colors.white )
- print( "CCU2 DJ Machine" )
- print()
- term.setTextColor( colors.lightGray )
- for k, v in pairs( tracks ) do
- paintutils.drawLine( 1, tracks[k][3], size[1], tracks[k][3], colors.white )
- term.setCursorPos( 2, tracks[k][3] )
- print( tracks[k][4].." - "..k )
- end
- paintutils.drawLine( 1, 16, size[1], 16, colors.gray)
- term.setCursorPos( 2, 16)
- term.setTextColor( colors.white )
- print( "Panel" )
- term.setCursorPos( 2, 17 )
- term.setBackgroundColor( colors.lightGray )
- print( "Press any track to play it." )
- local event, button, x, y = os.pullEvent( "mouse_click" )
- for k,v in pairs( tracks ) do
- if y == tracks[k][3] then play( tracks[k][2], tracks[k][1] ) end
- end
- end
- function play( name, songKey )
- local track = disk.getAudioTitle( "drive_"..name )
- if track ~= "wait" then track = string.sub( track, 8 ) end
- term.setCursorPos( 1, 17 )
- term.clearLine()
- term.setCursorPos( 2, 17 )
- print( "You will be playing: "..track )
- term.setBackgroundColor( colors.lime )
- term.setCursorPos( 2, 18 )
- write( " Play " )
- term.setCursorPos( 9, 18 )
- term.setBackgroundColor( colors.lightGray )
- write( " " )
- term.setBackgroundColor( colors.red )
- write( " Cancel " )
- term.setBackgroundColor( colors.lightGray )
- local event, button, x, y = os.pullEvent( "mouse_click" )
- if x >= 2 and x <= 6 and y == 18 then
- local sID = os.startTimer( songKey + .1 )
- disk.playAudio( "drive_"..name )
- term.setCursorPos( 2, 17 )
- print("You are now playing: "..track )
- term.clearLine()
- term.setBackgroundColor( colors.red )
- write( " Stop " )
- term.setBackgroundColor( colors.lightGray )
- while true do
- local event, tID, x, y = os.pullEvent()
- if x and y then
- if (x >= 2 and x <= 6 and y == 18) and (event == "mouse_click" or event == "monitor_touch") then
- disk.stopAudio()
- menu()
- end
- end
- if tID == sID and event == "timer" then
- menu()
- end
- end
- elseif x >= 9 and x <= 29 then
- menu()
- end
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement