Refreshing the Status Line and When the Player Consents

So when you use a ‘if the player consents’ type construction, it doesn’t refresh the status bar at the end of the line. In the following example, stuff happens when turn count is 3, but the status bar still says it’s turn two:

[code]The Banana Plantation is a room

When play begins:
now right hand status line is “Turns [bananas]/3”.

Bananas is a number which varies. Bananas is 0.

Every turn:
increase bananas by one.

Not enough bananas is a recurring scene. Not enough bananas begins when bananas is 3. Not enough bananas ends when bananas is 0.

When not enough bananas begins:
say “Are there enough bananas?”;
if the player consents, say “Really?”;
try looking;
now bananas is 0.[/code]

How can I get it to behave?

It seems to work for me, unless I’ve misunderstood the problem. Every time the question “Are there enough bananas?” is asked, the right hand status bar says “Turns 3/3” and then after answering, it changes to “Turns 0/3”. I don’t see where it still says turn two.

It’s Glulx-specific. See Inform bug 756. A workaround is to addTo redraw the status line: (- DrawStatusLine(); -). To decide whether the player consents: redraw the status line; decide on whether or not the player consents. to your story.

There is an I6 routine that refreshes the status line. You can wrap it in an I7 phrase and trigger it whenever you like. Unfortunately, I don’t remember the name of the routine, but you could find it by trawling through the template documentation (Appendix B). Your code would look something like this:

To refresh the status line: (- RefreshStatusLine(); -).

You forgot to mention that it was Glulx specific. This should work.


The Banana Plantation is a room.

Include (-

[ RefreshStatusLine posb;
	VM_MoveCursorInStatusLine(1, 2);
	switch(metaclass(left_hand_status_line)) {
		String: print (string) left_hand_status_line;
		Routine: left_hand_status_line();
	}
	VM_MoveCursorInStatusLine(1, posb);
	switch(metaclass(right_hand_status_line)) {
		String: print (string) right_hand_status_line;
		Routine: right_hand_status_line();
	}
	VM_MoveCursorInStatusLine(1, 1); VM_MainWindow();
];

-).

To refresh the status line: (- RefreshStatusLine(); -).

When play begins:
now right hand status line is "Turns [bananas]/3".

Bananas is a number which varies. Bananas is 0.

Every turn:
increase bananas by one.

Not enough bananas is a recurring scene. Not enough bananas begins when bananas is 3. Not enough bananas ends when bananas is 0.

When not enough bananas begins:
refresh the status line;
say "Are there enough bananas?";
if the player consents, say "Really?";
try looking;
now bananas is 0.

Hope this helps.

Thanks everybody, that’s a great help!

Is there a difference between Refreshing the status line and Drawing it?

In Emily Short’s menus, it has:

To redraw status line:
(- DrawStatusLine(); -)

Whenever I’ve wanted to poke the status line and say ‘hey, wake up’, I’ve just called her ‘redraw status line’ action.

There is no “RefreshStatusLine()” routine – that’s just a typo. (Unless somebody found one that I can’t find.)

Wow, that created a lot more confusion than I would have thought, given that I said clearly that RefreshStatusLine was not the name of the routine! It’s DrawStatusLine, as EmacsUser said in the post that went up while I was writing mine.

Sorry for not just downloading Appendix B to look it up before posting…

In addition to keeping the Standard Rules open in an emacs buffer, I like to keep the auto.inf (generated I6 code) of whatever game I compile last. Makes it easier to answer these low-level questions. :slight_smile:

What platform are you running on? When I open auto.inf in MacVim, it loses the file every time I compile - I assume because Mac uses file ids rather than plain text file paths, and it deletes and recreates the .inform directory when compiling.

I’m on a Mac. Yes, the directory gets wiped and rewritten every time. (Although not because there aren’t file paths underneath – there are.)

Emacs (by default) doesn’t care if the file changes out from under the buffer, unless you try to edit the buffer. If I’m recompiling and looking at the I6 source, I have to re-read the file after each compile. But that’s not typically what I’m doing.

That’s a good idea. I keep auto.inf open in TextWrangler when I’m debugging, but otherwise not. Wouldn’t have helped yesterday, though–I was on a virgin computer, by which I mean it had no Inform stuff at all on it!

MacVim is usually smart about files being changed, and will ask you if you want to reload whenever it does. I just checked and it had no problem with auto.inf while recompiling. I think the problem I had before was trying to set vi’s working directory to “project.inform/Build”. It didn’t like that!

Is there any simple way to call the Inform 6 “DrawStatusLine” routine below in Inform 7? I’m using Emily Short’s Basic Screen Effects, but I keep getting a compilation error.

Apparently I’m missing something relatively simply but very important here. :blush: :frowning:

Thanks in advance!

After compiling the following code, type “CHICK” to display the cut scene I’m trying to implement.

[code]“Forcing the Status Line 01” by Jay Goemmer

Include Basic Screen Effects by Emily Short.

When play begins: say “Introductory text here.”;
pause the game.

Chamber is a room. The printed name is “Featureless Chamber”.

Midair is a room. The printed name is “Suspended in Midair”.

Understand “chick” as transport one.

Transport one is an action applying to nothing.

Report transport one:
clear the screen;
move the player to Midair, without printing a room description;
say “[line break]Narrative text here.
[line break][line break]More narrative text droning on.
[line break][line break]Rattling on nonsensically some more.[paragraph break]”;
say “[bracket]MORE[close bracket]”.

[To redraw status line:
(- DrawStatusLine(); -) ]
[/code]

In other words, I’m trying to duplicate the behavior of “pause the game,” but substituting the “MORE” prompt for “Please press SPACE to continue.”

Thanks again in advance.

EDIT: The “pause the game” command stops everything right before the status line is redrawn. The code above, however, goes on to draw the status line and display the prompt (which I’m trying to postpone for the rest of the cut scene).

Have you looked at the contents of the Basic Screen Effects extension? The pause command is defined like this:

To pause the/-- game: 
	say "[paragraph break]Please press SPACE to continue.";
	wait for the SPACE key;
	clear the screen.

You could define a new phrase, perhaps “to pause the game with MORE”, which looks just like that except with a different message displayed.

As for redrawing the status line, are you sure you need to?

How about something like this?

[code]“Forcing the Status Line 01” by Jay Goemmer

Include Basic Screen Effects by Emily Short.

To pause the/-- game saying (message - an indexed text):
say “[paragraph break][message]”;
wait for the SPACE key;
clear the screen;
say paragraph break.

When play begins:
say “Introductory text here.”;
pause the game.

Chamber is a room. The printed name is “Featureless Chamber”.

Midair is a room. The printed name is “Suspended in Midair”.

Understand “chick” as transport one.

Transport one is an action applying to nothing.

Report transport one:
clear the screen;
move the player to Midair, without printing a room description;
say “[line break]Narrative text here.[paragraph break]More narrative text droning on.[paragraph break]Rattling on nonsensically some more.”;
pause the game saying “[bracket]MORE[close bracket]”.[/code]

Here, you can customise the message each time.

Also, you can deal with the status line with the printing the status line activity.

Hope this helps.

I finally managed to find the source code (instead of just the HTML files) on my Windows 7 machine at:

Program Files (x86) / Inform 7 / Extensions / (e.g.) Emily Short / *.i7x

I’ll try this, and see if it does what I want.

(chuckling) I think so. It may be a coding “cheat,” but that’s how I did it in Inform 6.

It looks like this will require some additional experimentation. Thanks for your response! :smiley:

This obviously replicates the current behavior, which still prints the “Wait” message and pauses the game before drawing the status line.

That’s probably what I want to do. Where do I look to find out how to do that? (I just tried searching the I7 documentation and this forum, to no avail.)

Thanks so much! :smiley: