Slowing down the console...?

closed account (L3ApX9L8)
Hi, just a quick question this time...
Is there a way to slow down the speed at which the console produces text?
You see, am trying to create a sort of 'NPC' for a Choose-your-own-adventure-kidnf-of-game, but the speed at which it speaks is sort of off-putting...

is there any possible solution?
One possibility is to write your own print function that has a time delay between each character in the string to be printed. For example, something like this:
1
2
3
4
5
6
void print_slow(string const & str, unsigned const delay_between_chars) {
  for (int i = 0 ; i < str.size() ; ++i) {
    cout << str.at(i);
    delay(delay_between_chars);
  }
}

A delay function:
http://www.cplusplus.com/forum/unices/10491/page1.html#msg49054
The argument is in milliseconds (10-3).

Good luck!
Last edited on
Topic archived. No new replies allowed.