Specifying an ordering of the player's inventory

Hello! First I wanted to thank everyone for this tremendous site… it’s been a great help in my recent adventure creation! I’ll head over to the introductions thread next and make myself known there in proper fashion.

But first, the main order of business: giving a specific order when listing the player’s inventory. I really don’t want anything fancy; basically I’ve created a special indefinite article for the player’s umbrella (“your trusty”), and I want this to always appear last when taking inventory, for reasons of style and downright cuteness. As to actually implementing the list-ordering, however… this has given more trouble than it probably ought. I was sure there was an example similar to this in I7’s documentation, but was unable to find it (am I just missing it?); and the Complex Listing extension seems too bulky a thing to add for such a small matter. Any help would be greatly appreciated! :mrgreen:

If the player can never drop and take or loose and regain his trusty umbrella, I think all you have to do is make sure that the line ‘The player carries an umbrella.’ comes after any other line about what the player is carrying or wearing.

Otherwise here’s a hack that might do the trick:

[code]Before listing contents of the player when the player carries the umbrella: now the umbrella is off-stage.
After listing contents of the player when the umbrella is off-stage: now the player carries the umbrella; say “[indentation][an umbrella][paragraph break]”.

To say indentation: (- if (c_style & INDENT_BIT) PrintSpaces(2*c_margin); -).[/code]

Aha! Thank you so much! This definitely does the trick. Though when the player is carrying only the umbrella, we’re told that we’re carrying nothing and the umbrella, so changing the first line to Before listing contents of the player when the player carries the umbrella and the player carries at least one thing that is not the umbrella: now the umbrella is off-stage. works, since if the player is carrying only the umbrella then obviously the ordering isn’t an issue.

Awesome! Thanks again! :mrgreen:

If I’m tuning the inventory listing, I sometimes wind up with a rule like this:


Instead of taking inventory:
	if the number of things carried by the player is zero:
		instead say "You have nothing.";
	now everything enclosed by the player is not marked for listing;
	now everything carried by the player is marked for listing;
	if the player carries the umbrella:
		if the number of things carried by the player is one:
			instead say "You have nothing but your umbrella.";
		now the umbrella is not marked for listing;
		say "You have your umbrella, and also:[line break]";
	else:
		say "You carry:[line break]";
	list the contents of the player, listing marked items only, with newlines, indented, including contents, giving inventory information, with extra indentation.

(May require further tweaking if the player is wearing clothing.)

Yeah, that’s the next bit I’ll be puzzling out (after I actually add wearable objects to the game, that is).