Skip to main content
gamedev.net
🔒 Locked

Time Loop?

Started by Gameman17 1 reply 350+ views
Original Post
Gameman17
Gameman17
In this text based game I am trying to write I need a way to pause the program for as long as I choose, like 3 sconds or something. So that the sentences don''t just keep blasting out, you know I need it stop long enuff for the player to read before the next sentence! Please help!
Askadar
Askadar
Most compilers have a library function like sleep(), or wait() or something like this. You should use one of those.

In case it doesn''t support anything like that, change your compiler!

If you can''t change your tool you could try to simulate a sleep() by calculating something very large, like doing 100.000 useless floating point operations. You could try to approximate the time with the number of operations, but this is really bad because you use up all the cpu time of the system (DON''T do this in multithreaded environments, you basically stall the system).
Kill mages first!
TheSalmon
TheSalmon
Why not just use a getch() and let the player decide when to read on?

---
No game will ever rule more than CBT!
---Mikael Lax

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.