I'm thinking this is a problem.
Try out this simple program. Run it. It runs correctly.
-- error with local time() function _init() cls() ?"*" timeout(1) ?"*" end function timeout(n) local t=time() while time()-t<n do flip() end end |
Now right then type in immediate mode: timeout(1)
followed by ENTER.
It HANGS. I was thinking I was doing something wrong in the code I've been working on the past month now and no, it's something Pico-8 is doing ...
This does
work correctly if you run it in immediate mode in Pico-8 v0.2.0. So it is something that has changed in the system since then, @zep.
I got a bit long winded (as usual) but this reddit thread has a potential solution for you. Basically flip() eats up a frame's worth of time. Assuming immediate mode is updating at 30 fps then you can delay for one second by calling flip() 30 times in a loop. Multiply by however many seconds you want to wait.
My long winded speculation about why your existing code stopped working:
That's ... quite the answer, @jasondelaat, and thanks for responding.
I was just pointing out that timeout()
works correctly in Pico-8 v0.2.0 but not the version past that.
If it's something @zep wants to fix, that's fine. If not, for instance, it is running correctly NOW the way it is supposed to where it hangs, then that is also fine.
It does get confusing sometimes though when you can do one thing in a version and have it fail in later versions.
[Please log in to post a comment]