Jump to content




My Jukebox Program

peripheral

2 replies to this topic

#1 Raystone

  • New Members
  • 2 posts

Posted 20 February 2015 - 07:27 PM

Hi people. I've made a Jukebox Program. Here are the programs:

startup:
shell.run("bg startup1")

startup1:
title = disk.getAudioTitle(dSide)
m = peripheral.wrap("left")
m.setTextScale(0.5)
dSide = "drive_1"
m.setBackgroundColor(colors.black)
m.setTextColor(colors.white)
m.clear()
m.setCursorPos(1,1)
m.write("X Play")
m.setCursorPos(1,2)
m.write("X Stop")
m.setCursorPos(1,3)
m.write("X Edit")
m.setCursorPos(1,4)
m.write("X Exit")
while true do
   event, side, x, y = os.pullEvent("monitor_touch")
	 m.setCursorPos(1,6)
	 m.clearLine()
	 if x == 1 and y == 1 then
		  m.setCursorPos(1,5)
		  m.clearLine()
		  if disk.hasAudio(dSide) then
			   disk.playAudio(dSide)
			   m.setCursorPos(1,6)
			   m.write("Playing "..title)
		  else
			   m.setCursorPos(1,6)
			   m.write("No Audio")
		  end
	 elseif x == 1 and y == 2 then
		  shell.run("dj stop")
	 elseif x == 1 and y == 3 then
		  m.setCursorPos(1,3)
		  m.write("X Edit - Editing...")
		  shell.run("edit startup1")
		  shell.run("startup")
	 elseif x == 1 and y == 4 then
		  shell.run("clear")
		  disk.stopAudio("drive_0")
		  m.setCursorPos(1,6)
		  m.clearLine()
		  m.write("Not Running...")
		  shell.run("shell")
	 end
end



First it worked very well, but later I got this:

Quote

disk:3: Expected string

Here are some pictures of it:
Posted Image

Posted Image

In my Disk Drive is nothing else than a Music Disk.
I've tested it on other (new) computers, but no result...
Can anyone help me?

P.S. Sorry for my bad language. I'm not grown up with this language

#2 Quintuple Agent

  • Members
  • 107 posts
  • LocationThis page

Posted 20 February 2015 - 07:48 PM

A problem i see is that when you call disk.getAudioTitle, dSide has not been set, so it is nil.
dSide = "drive_1"
should come before
title = disk.getAudioTitle(dSide)


#3 Raystone

  • New Members
  • 2 posts

Posted 20 February 2015 - 07:50 PM

Thanks. It's working again! The topic can be closed now.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users