This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kingdaro's profile picture

[1.41] sleep() needs to accept more specific increments

Started by Kingdaro, 25 August 2012 - 11:49 PM
Kingdaro #1
Posted 26 August 2012 - 01:49 AM
I'm trying to use a computer to play gangnam style, however I figure that the increments aren't specific enough as the song always plays too slow or too fast.

Gangnam style is at approx. 131 BPM. The time between quarter beats is, determined by calculator, 0.11450381679389312977099236641221.

0.1 produces the exact same result, which is 150 BPM - a huge noticeable difference, which is how I know this.

The song sounds as if it's playing at ~100-110 BPM, and that makes this fact even more ridiculous.
Cloudy #2
Posted 26 August 2012 - 08:02 AM
Sleep works on minecraft ticks, meaning the smallest increment of time will be 0.05.
Kingdaro #3
Posted 26 August 2012 - 08:26 PM
Is it possible for sleep() to not rely on ticks?
mesaif1337 #4
Posted 26 August 2012 - 10:11 PM
im pretty sure that sleep does not rely on minecraft ticks, when i was making my password door (first script) i did sleep(5) so the door would stay open for 5 seconds, then close, and it closed after 5 seconds, however, im not sure, as the ticks per second changes depending on your Fps, so please give me your average Fps to figure out how many ticks per second you are getting. at 100Fps it's 16Tps i think.
Tiin57 #5
Posted 27 August 2012 - 12:20 AM
Sleep() relies on ticks, but is measured in seconds, so that you enter measurements of seconds, but increments of ticks.
immibis #6
Posted 27 August 2012 - 05:44 AM
im pretty sure that sleep does not rely on minecraft ticks, when i was making my password door (first script) i did sleep(5) so the door would stay open for 5 seconds, then close, and it closed after 5 seconds, however, im not sure, as the ticks per second changes depending on your Fps, so please give me your average Fps to figure out how many ticks per second you are getting. at 100Fps it's 16Tps i think.
Minecraft always runs at 20 TPS, unless it takes more than 50ms to do a tick.