trouble with screen width and screen height

I can’t seem to get screen width and screen height to report correctly. Screen height is always returned as 11 in all the interpreters I’ve tried it on, and screen width is in the ballpark, but not quite accurate.

(I assume these are measuring width and height when printing with “fixed letter spacing”.)

I’m using 6L38.

Unrelated question: is it possible to search these forums for a specific multiple-word phrase?

I tested with

+Emily +revolution +inkle

and it returned posts about First Draft of the Revolution that mentioned Inkle and Emily Short.

So I’m sure you can do

+the +quick +brown +fox

and it should require all the words in your search.

Basic Screen Effects has the following:

[code]To decide what number is screen height:
(- I7ScreenHeight() -).

Include (-

[ I7ScreenHeight i screen_height;
i = 0->32;
if (screen_height == 0 or 255) screen_height = 18;
screen_height = screen_height - 7;
return screen_height;
];

-).[/code]

I can see how that might end up returning 11 all the time, but I can’t tell if it’s a bug, or if the interpreters are not reporting correctly, or if there’s something I’m just not getting. Any ideas?

Ha! That’s definitely a bug!

Put this in your game:

To decide what number is the/-- actual screen height: (- I7ScreenHeight2() -). Include (- [ I7ScreenHeight2 i; i = 0->32; if(i == 0 or 255) i = 18; return i - 7; ]; -).

Now you can check the “actual screen height”. This is worth filing as a bug, also.

Thanks Daniel. I tried that, and now the behavior is more complicated. When compiling to ULX, Gargoyle/Git always gives 154 for “actual screen height”, and the Windows Inform window gives 237.

When compiling to Z8, the Windows Inform window gives 19. The value in Frotz varies, but it always seems too small.

Hmm.

This is a little over my head, but there appears to be a ScreenHeight function in I6 now.

So this is what my code looks like now:

To decide what number is the/-- actual screen height: (- VM_ScreenHeight() -).

That appears to give an accurate result in Frotz and Git.

There is no perfect answer to your question outside of terminal-window interpreters. (Which can assume a fixed-width font across the entire application.)

The spec talks about measuring based on “0” characters in the “normal” (not fixed-width) font, on the theory that digits are usually fixed-width even in proportional fonts. (Usually, but not necessarily!) But it’s just not something you can rely on. The interpreter may not even have access to complete font information.

This is good to know – thank you.

I can’t explain what that code is meant to be doing in Basic Screen Effects. It’s also really old. I’m amazed no one’s noticed it before. I guess because most people have migrated to Glulx.