Why do games call system(32) for "more" prompts?

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
RealNC
Posts: 2244
Joined: Wed Mar 07, 2012 4:32 am

Why do games call system(32) for "more" prompts?

Post by RealNC »

I recently noticed that almost every game seems to eat up CPU cycles when just waiting for a key press after showing a "more" prompt. They seem to do the following:

Code: Select all

while not key
{
    system(32)
    key = system(11)
}
I'm wondering what the reasoning is. I would have expected a "pause" statement instead of generating CPU load on something that should be a simple wait operation?

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

It's used as a fancy cursor-hider during "press a key" type things. Honestly, I was unsure how much processing power such a trick would use up. If it's really drastic, I could change it so the cursor goes to the status window (which should be hidden in Hugor, right? even though it'd still show in the old official 'terp).

User avatar
RealNC
Posts: 2244
Joined: Wed Mar 07, 2012 4:32 am

Post by RealNC »

Roody_Yogurt wrote:It's used as a fancy cursor-hider during "press a key" type things.
OK, that makes sense. I forgot about the blinking cursor hack in Hugor.

Honestly, I was unsure how much processing power such a trick would use up. If it's really drastic, I could change it so the cursor goes to the status window (which should be hidden in Hugor, right? even though it'd still show in the old official 'terp).
I assume you mean RoodyLib. No, I think keeping it as-is is a good idea. The CPU load can be reduced in Hugor itself, as right now it does some unnecessary screen repaints that I can cut down on. Since there's no output from the game during the delay/getkey loop, getting rid of the repaints should reduce the CPU load.

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

Yeah, I meant in Roodylib, since it has a HiddenPause routine for "press a key" type stuff (although it's based on some Future Boy! code so it shows up in spots there, too).

Post Reply