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.
Autoplaying Jukebox Program Not Repeating The Disk Properly
Started by SteamPunkCherub, Jul 26 2013 02:58 AM
2 replies to this topic
#1
Posted 26 July 2013 - 02:58 AM
#2
Posted 26 July 2013 - 11:37 AM
Split into new topic.
#3
Posted 26 July 2013 - 10:05 PM
I finaly solved it, seems kinda simple now.
I just took this if then statement
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
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











