accentColor = colors.gray buttonColor = colors.lightGray backgroundColor = colors.black function round(n) return n % 1 >= 0.5 and math.ceil(n) or math.floor(n) end width, height = term.getSize() centerWidth = round(width / 2) centerHeight = round(width / 2) peripherals = peripheral.getNames() playing = false if #peripherals < 0 then print "No drive" else driveCount = 0 for n = 1, #peripherals do local driveCheck = peripherals[n] if peripheral.getType(driveCheck) == "drive" then drive = driveCheck driveCount = driveCount + 1 end end if driveCount > 1 then print("Too many disk drives. Specify where the disk drive is by running Rhythmblock with the argument") os.exit() end end defaultStatus = "Rhythmblock 0.0.1a" invalidFormatStatus = "Not a music disc" noDiscStatus = "No disc" notPlayingStatus ="No disc playing" noDiscInDriveStatus = "No disc in drive" status = defaultStatus function playDisc() if disk.isPresent(drive) and disk.hasAudio(drive) then disk.playAudio(drive) status = disk.getAudioTitle(drive) playing = true elseif disk.isPresent(drive) then status = "Not a music disc" else print("No disc") end end function ejectDisc() disk.eject() end function stopDisc() if playing == true then disk.stopAudio() playing = 0 status = defaultStatus else status = "No disc is playing" end end function renderPlayButton() paintutils.drawFilledBox(centerWidth - 3, centerHeight - 4, centerWidth + 2, centerHeight + 2, accentColor) paintutils.drawLine(centerWidth - 2, centerHeight - 3, centerWidth - 2, centerHeight + 1, buttonColor) paintutils.drawLine(centerWidth - 1, centerHeight - 2, centerWidth - 1, centerHeight, buttonColor) paintutils.drawPixel(centerWidth + 1, centerHeight) end renderPlayButton()