2 Second Pause In-Game

Does anyone know of a way that a 2-second pause can be implemented within a project?

I’ve been playing around with Basic Screen Effects by Emily Short. I like the ‘Wait for Any Key’ routine and I have been trying to modify it to wait for 2 seconds rather than a key-press, but alas, I’m not familiar with the source code and have had no luck thus far.

I like the idea of occasional timed pauses between paragraphs. i.e:

You go west…

(2 second pause)

Gronbach is here! He hits you over the forehead with the aluminium tongs. Ouch!
You are dead. Your score was 12/180.

etc etc

I’ve wondered about this, too. I’m not sure if it’s exactly possible, but you can use the same trick I do on when programming my calculator: do some very complex math repeatedly. This will force the program to stop for a while, though timing it exactly will be a matter of trial and error. I usually use a bunch of nested trig functions on the calculator, but for I7, you would probably want to use something involving randomization. Something like this: let the pause-time be 50; while the pause-time is not 0: now the pause-time is the pause-time - 1; if a random chance of 1 in 500 succeeds: do nothing.

(I have absolutely no idea how long that code will pause for, and you’d probably want to start with smaller numbers to prevent an absurdly long pause that you can’t break out of.)

I’ve written an extension that does this. I haven’t submitted it to the extension archive yet (actually, I did, but long story…), but it’s been posted on the net a couple of times:

dl.dropbox.com/u/947038/Real-Time%20Delays.i7x

This is Glulx-only.

–Erik

It is possible, although I don’t have the code right on me. You can set up a timer event. There’s probably an extension somewhere.

(Definitely don’t do a busy-wait loop, which is what biophysicist’s code does. Sorry. It’s horrible for the UI, and it guarantees that the interpreter will use up as much battery as possible on a laptop or mobile device.)

But timed pauses are very tricky, because everybody reads at a different speed. It is certain that some people will get frustrated waiting for the pause to end, and others won’t even reach the break before the pause ends. (Yes, it is possible to get bored waiting two seconds. It is possible to get bored waiting half a second.)

At a mininum, be sure that the player can hit space to end the pause.

Crossed posts, I see… I told you there was an extension.

But accepting any key is still better than requiring an escape.

Have to agree there, and I think allowing space/enter to continue is considered ‘good behavior’ in timed dialogs in graphical games as well (i.e., of the sort where the character talks in a dialog box, and then after a bit a new box comes up with more dialog). Imagine if your player has played the game multiple times – they may just want to skip through certain dialog.

An ‘average’ reading speed is 4 words per second, though I’m guessing most IF readers will be well above that.

Thanks for the help - the extension is just what I was looking for.

I can imagine that too much usage of timed pauses would be irritating. For my purposes however, just now and again is perfect. Or even just a 1.0 second pause after the player moves into a new room: to give a slight impression of movement.

Good point about allowing Enter and Spacebar for delays of this kind. I threw this extension together for someone who asked for it on RAIF, cannibalizing code I had used to create delays for animation–i.e., delays I didn’t want the player to be able to stop. I distinctly remember that the original person who asked for this code didn’t want the player to be able to “fast-forward,” but as a fast reader I definitely think Zarf is right about the potential for boredom/annoyance, and in the context of this extension it makes a lot more sense to have multiple keys that can forward the action. For now, I’ve gone with Return, Enter, Space, and Escape, though I’d also be open to allowing any old key to do it. We’ll see if any input rolls in from users/players.

I’ve updated the extension to make this change, and I’ve also removed the need for Michael Callaghan’s Fixed Point Maths extension–you now provide the time in milliseconds rather than seconds.

–Erik

In addition to points people have given above, one major problem with timed pauses is that when the pause ends and the game continues, the new text pushes the old higher in the screen. If the player is still reading the old text the jolt makes them lose the spot where they were and search it again so that they can continue reading. If there are several timed pauses in succession there’s not much more to do than to stop reading, wait for the pausing to stop and read the whole thing when you know it’s not bouncing around uncontrollably anymore.

I’m not saying timed pauses can’t be done right, but if you’re going to have them, it’s pretty much mandatory to get other people to try the game out before the release to see what they think of the effect.

While we’re on the subject of delayed text (something I myself was looking for in the form of Emily Short’s Basic Screen Effect’s “wait for any key”), is there an extension that has the text “typed” to you rather than appear as a block?

I just posted an answer to this, but it seems to have been eaten… I’ve added an example to the Real-Time Delay extension that shows how to do this.

–Erik

Got around to trying out your teletype thing, and it won’t work. I even tried directly copy and pasting the “To teletype” method, and it still errors.

The error is:

[code]Problem. The phrase or rule definition ‘To teletype ( text-to-be-printed - an indexed text )’ is written using the ‘colon and indentation’ syntax for its 'if’s, 'repeat’s and 'while’s, where blocks of phrases grouped together are indented one tab step inward from the ‘if …:’ or similar phrase to which they belong. But the tabs here seem to be misaligned, and I can’t determine the structure. The first phrase going awry in the definition seems to be ‘repeat with N running from 1 to the number of characters in the text-to-be-printed’ , in case that helps.

This sometimes happens even when the code looks about right, to the eye, if rows of spaces have been used to indent phrases instead of tabs.
[/code]

This is with the copy and pasted version, so i’m using your indentations.

EDIT: Got it to work. I guess the indents weren’t large enough. Made my own indents with the tab key and now it works. However, it seems as though no matter how low I set the wait number the text is typed extremely slowly, even at 3 milliseconds.

Thanks for the report. I just tested it and it works fine.

You say you’re copying and pasting. That won’t work, whether you’re copying from the original text file or from the “Installed Extensions” page in the IDE. There’s an extra tab in front of every line in the text file, so that will screw up Inform. The Installed Extensions is in HTML, so the tabs are converted to spaces, which will also confuse Inform. You need to press the blue-on-gray paste button next to the title of the example in the installed extension docs–if you do this, Inform will correctly convert spaces to tabs and paste automatically.

Let me know if that works. If it doesn’t, there may be a bug in the IDE (I’m using the Mac IDE).

–Erik

It sounds like you didn’t use the paste button and had to replace the spaces with tabs.

I can see clear differences in speed between 3 and 20 millisecond delays (using Zoom in the Mac IDE), as well as other terps. A 3-millisecond delay is quite fast. What interpreter/IDE are you using? If your computer is very slow, or the interpreter (or the version of the terp that’s in the IDE is slow), you may not get very good response. Try “releasing” a gamefile and opening it in a different interpreter.

EDIT: Gargoyle (pre-release Mac build) is pretty slow whether you set it to 1 or 20 ms. I’ll report this to the Gargoyle devs as a bug.

–Erik

I’m on a pretty powerful Windows PC (I can run Crysis on high settings), and i’m using Inform’s own preview interpreter.

Hm, I believe that would be a modified version of WinGlulxe. It sounds like not some interpreters are just not good at printing text quickly. There’s not much to be done about it except bring it to the attention of the interpreter writers. (It’s interesting to note that both Gargoyle and WinGlulxe are faster at displaying animated graphics than animated text…)

–Erik

I also seem to have another problem.

I teletype one piece of text (20 ms for each letter), I wait for 2000 ms (two seconds), then teletype a second piece of text. During play, the two second delay is nonexistant; it continues to type at 20 ms each letter without stopping.

I even amped the number to 2 million, and the pause is still nonexistant.

I’ve tried using both Glulx interpreters that come with Inform (Glulxe and Git) with no improvement.

You’ll need to post your code, I think.

Not really much to post. The teletype is the same as yours (using the same numbers).

Then during an Instead rule (examining the character of Cheif Buga), I have this happen:

teletype “The great and wise Cheif Buga stands before you on a pedistal, illuminated by the two torches on either side of him.”;
wait 2000 ms before continuing;
teletype " He is a giant of a man (both in height and weight), with hands so large he could crush your skull like a paper cup.".

Inform seems to ignore that two second wait for some reason, yet no error appears.

Hm, I can’t really explain this either. It works fine for me in Zoom and Gargoyle on OS X. What happens at the line breaks in the original example? Do you get the extra pause (400 ms) there?

By the way, I’ve asked David Kinder (who maintains WinGit and WinGlulxe) to peek at this thread, so he may weigh in at some point.

–Erik