Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.duesseldorf.ecrc.net!news.ecrc.de!02-newsfeed.univie.ac.at!newsfeed.uk.ibm.net!news.stealth.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform] Status Line question
Message-ID: <erkyrathDyDLMs.GBF@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <1996Sep26.154817@carleton.edu>
Date: Fri, 27 Sep 1996 05:23:16 GMT
Lines: 70
Sender: erkyrath@netcom21.netcom.com

chris markwyn (markwync@carleton.edu) wrote:
> I'm trying to fool with my status line, to blatantly steal Andrew Plotkin's
> neat little technique of the cryptic yet evocative words for each set of
> locations from SO FAR.  But I can't figure out how to do it.

I guess it wouldn't hurt if I posted the source, then. :-)

[ DrawStatusLine
	width posa i;
	@split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
	statusprinting = 1;
	width = 0->33; 
	spaces (width);   ! A pox upon buggy interpreters!
	@set_cursor 1 2;  
	PrintShortName(location);
	i = parent(player);
	if (i ~= location && location ~= thedark) {
		if (i has supporter) { print ", on "; }
		else { print ", in "; }
		DefArt(i); 
	}
	if (weather ~= 0) {
		posa = width-31; 
		if (posa >= 34) {
			@set_cursor 1 posa; 
		} 
		print " (", (string) weather, ")";
	}
	statusprinting = 0;
	@set_cursor 1 1; style roman; @set_window 0;
];

Some explanations:

The "cryptic words" are a string stored in the global variable weather. 
(Called that because the code is derived from "A Change in the 
Weather..." :-) You could just use location.statuswords, or whatever 
property you have it set up in.

The strange-looking line "width = 0->33" just sets width to the width of 
the status window. Header byte 33 contains that info.

All my weather strings are 30 characters or less. So I display them
starting 31 characters from the right margin (as determined by width),
*unless* the screen less than 65 characters wide. (if width-31 < 34, you
see.) In that case, there's no cursor repositioning, so the weather string
appears right after the location string. If it still overflows the window
width, too bad. 

There is also a hack so that, for example, "on the bench" is added to the 
location name if the player is on the bench. Easy enough to delete that 
code if you don't want it.

The global variable statusprinting is a *really* dirty hack; certain 
objects print a shorter ShortName if statusprinting is 1. This helps keep 
the status line from overflowing. If you delete the "on the bench" code, 
you can probably delete the references to statusprinting as well.

The comment about "pox" is because a few old interpreters (wrongly) 
wrap around an extra line if you print in the last column of the last row 
of the status line. You can prevent this by printing (width-1) spaces 
instead of (width) spaces. I chose not to worry about it. Nobody has 
complained. 
 
--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
