Search the Community
Showing results for tags 'loop'.
Found 3 results
For some reason break isn't exiting this while loop, when I input "exit" it just prints it and continues the loop instead leaving it. While true do Local input = term.read () Term.write (input) If input == "exit" then Break End End
TL;DR: http://pastebin.com/DG1wiRDc I was messing around with tape drives and trying to make them loop, and it turns out that it's a bit more complicated than it would seem. If the audio used is shorter than the tape, the tape doesn't automatically stop when the audio ends, instead playing silence for the rest of the unused tape length, before stopping. This renders isEnd() and .getState() useless, because after the audio is over, the tape will still play, only actually ending (and stopping) several minutes later (audio and tape length assumed to differ by several minutes, your mileage may vary). After doing lots of research and messing with the API, I found the command read(), which reads the current byte. It seems that even with the audio having quiet points (assuming you've written the audio starting from the beginning of the tape, but I did minimal testing), the read() command returns "0" when the audio of the tape ends, which I used to detect when to rewind and replay. With an internet card, you can run pastebin get DG1wiRDc Loop to download the program, running it with Loop Unfortunately, I didn't have much luck adding a way to abort the program, so you might have to power cycle the computer to get it to stop. BONUS: http://pastebin.com/CZ1kJFMB Here's another program I wrote, you might have to fiddle with it a bit for it to work for you, because I just bodged this together in an attempt to rickroll someone.