Jump to content




Autoplaying Jukebox Program Not Repeating The Disk Properly


  • You cannot reply to this topic
2 replies to this topic

#1 SteamPunkCherub

  • New Members
  • 2 posts

Posted 26 July 2013 - 02:58 AM

I've been working on this code all day, its one of the first things I've programed in Lua (tho I have some knowledge of other languages). The program works nearly as intended excpet it tends to loop the disk too early.

here is a pastebin to the code: http://pastebin.com/u0d116nX

It seems to misbehave after the music disk has been restarted using 'P', my guess is that each time it is told to play it creates a new timer, and the extra timers are making it loop at the wrong times, but I've run out of ideas on how to fix it.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 26 July 2013 - 11:37 AM

Split into new topic.

#3 SteamPunkCherub

  • New Members
  • 2 posts

Posted 26 July 2013 - 10:05 PM

I finaly solved it, seems kinda simple now.
I just took this if then statement
if input == "P" or loop then
	  timer = os.startTimer(time)
	  playing = true
	  disk.playAudio(ddisk)
	  loop = false
	elseif input == "S"then
	  timer = 0
	  time = 0
	  playing = false
	  disk.stopAudio(ddisk)
	end

and added a "input = "" line after "loop = false" and disk.stopAudio(ddisk)
derp

final code: http://pastebin.com/GKg3f2Dm
much sloppier than i'd like, having picked at it non-stop to figure this out lol

Edited by SteamPunkCherub, 26 July 2013 - 10:09 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users