I’m sorry if this is an stupid question, but I have been unable to find anything on it on my own. Does Inform 6 or Inform 7 have any ways of measuring how much time has passed in real time?
I have taken a look at Glulx Real Time by Erik Temple, but the whole extension seems a bit overwhelming for me, so I couldn’t understand it completely and using it seems a bit much for something that should be simpler. The extension is also not working perfectly in this exact situation.
For context, what I want to do is:
let startTime be the current time in milliseconds; [ although seconds would work, precision is always nice ]
let duration be 6000; [or 6]
while (current time - startTime) < duration:
read a player's keypress;
process that keypress;
[ The mini-game itself is working fine, it's just the counting of time that's problematic ]
Currently, I’m using a number that varies called time elapsed and increasing it like so, using Erik Temple’s extension:
now Time elapsed is 0;
let chron be chron for every 100 milliseconds up to duration times say "[@ increment time elapsed]";
[ do the things ]
deactivate chron;
stop virtualized timers;
The problem with this is that it seems that while keys are being pressed, the internal timers in Glulx (used in Erik Temple’s extension) stop working. So at best a player will be getting a few extra milliseconds or seconds at the whole event, but at worst the time taken for it will be much higher than it should have been. I had “countered” this by increasing the timer in .1 seconds for every two keypresses (which would not always be realistic and could even be worse - removing time from the player). So… Works, but non-ideal.
So, does Inform 7 (or 6) have any way of getting the current time in seconds or milliseconds? I am also using Glulx.