Inform 7: "Description Rank" with Room Description Control

I’m trying to use the “description-rank” feature in the extension “Room Description Control by Emily Short.” Apparently (yet again! :blush: ) I’m missing something. Here’s the source code:[code]“Description Rank 01” by Jay Goemmer

The story headline is “An Interactive Example”.

Include Room Description Control by Emily Short.

Testing Lab is a room. The printed name is “Testing Lab”.

Rule for writing a paragraph about Thing 1:
say “Thing 1.”

Thing 1 is fixed in place in Testing Lab. The description is “[line break]This is Thing 1.” The description-rank is 5.

Rule for writing a paragraph about Thing 2:
say “Thing 2.”

Thing 2 is fixed in place in Testing Lab. The description is “[line break]This is Thing 2.” The description-rank is 2.

Rule for writing a paragraph about Thing 3:
say “Thing 3.”

Thing 3 is fixed in place in Testing Lab. The description is “[line break]This is Thing 3.” The description-rank is 3.

Rule for writing a paragraph about Thing 4:
say “Thing 4.”

Thing 4 is fixed in place in Testing Lab. The description is “[line break]This is Thing 4.” The description-rank is 4.[/code]

+++

Here’s the resulting transcript:

[i]Description Rank 01
An Interactive Example by Jay Goemmer
Release 1 / Serial number 121204 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Testing Lab
Thing 1.
Thing 2.
Thing 3.
Thing 4.

[/i]

I’ve designated the description-rank for Thing 1 as 5. If it worked, shouldn’t Thing 1 be at the bottom of of the list under Things 2 through 4?

As usual, I need all the help I can get. :unamused: So any insight you can give me is greatly appreciated, as always! :wink: :smiley:

Thanks,

I’m not sure as to whether you’re using the “Room Description Control by Emily Short” extension for the sole purpose of ordering the object description paragraphs or for something else as well. However, if you’re just looking to reorder the paragraphs, you can use this instead.

[code]“Description Rank 01” by Jay Goemmer

The story headline is “An Interactive Example”.

Rule for choosing notable locale objects for the testing lab:
set the locale priority of thing 1 to 4;
set the locale priority of thing 2 to 1;
set the locale priority of thing 3 to 2;
set the locale priority of thing 4 to 3.

The Testing Lab is A Room. The description of the testing lab is “This is the testing lab.”.

The thing 1 is fixed in place in the testing lab. The description of the thing 1 is “This is Thing 1.”.

Rule for writing a paragraph about the thing 1: say “Thing 1.”.

The thing 2 is fixed in place in the testing lab. The description of the thing 2 is “This is Thing 2.”.

Rule for writing a paragraph about the thing 2: say “Thing 2.”.

The thing 3 is fixed in place in the testing lab. The description of the thing 3 is “This is Thing 3.”.

Rule for writing a paragraph about the thing 3: say “Thing 3.”.

The thing 4 is fixed in place in the testing lab. The description of the thing 4 is “This is Thing 4.”.

Rule for writing a paragraph about the thing 4: say “Thing 4.”.[/code]

You can read more about this in “17.25. Choosing notable locale objects for something” in the Inform 7 Documentation. You may also want to take a look at " Example 344 - Priority Lab", which might come in handy.

Hope this helps.

The problem you’re having with “Room Description Control” seems to be that you’re not using the description-rank in the way it expects. Instead of assigning a description-rank to an object, you need to write ranking rules for it, like this:

A ranking rule for Thing 2: now the description-rank of Thing 2 is 2.

If you look into the code for Room Description Control, the key rule is this:

A description-priority rule (this is the description-ranking rule): now lowest-rank is 1000; repeat through the Table of Seen Things begin; now the description-rank of the output entry is 0; consider the ranking rules for the output entry; now the current rank entry is the description-rank of the output entry; if description-rank of the output entry is less than lowest-rank, now lowest-rank is description-rank of the output entry; end repeat; sort the Table of Seen Things in reverse current rank order;

The line “now the description-rank of the output entry is 0” is throwing out the value of the description-rank that you set in your code, and then it’s running the ranking rules to see what description-rank it should give it. Since there aren’t any, I’m pretty sure the description-rank is staying at 0, so everything winds up listed in source code order.

If you put in ranking rules instead of assigning description ranks, it works:

[code]“Description Rank 01” by Jay Goemmer

The story headline is “An Interactive Example”.

Include Room Description Control by Emily Short.

Testing Lab is a room. The printed name is “Testing Lab”.

Rule for writing a paragraph about Thing 1:
say “Thing 1.”

Thing 1 is fixed in place in Testing Lab. The description is “[line break]This is Thing 1.”
A ranking rule for Thing 1: now the description-rank of Thing 1 is 5.

Rule for writing a paragraph about Thing 2:
say “Thing 2.”

Thing 2 is fixed in place in Testing Lab. The description is “[line break]This is Thing 2.”
A ranking rule for Thing 2: now the description-rank of Thing 2 is 2.

Rule for writing a paragraph about Thing 3:
say “Thing 3.”

Thing 3 is fixed in place in Testing Lab. The description is “[line break]This is Thing 3.”
A ranking rule for Thing 3: now the description-rank of Thing 3 is 3.

Rule for writing a paragraph about Thing 4:
say “Thing 4.”

Thing 4 is fixed in place in Testing Lab. The description is “[line break]This is Thing 4.”

A ranking rule for Thing 4: now the description-rank of Thing 4 is 4.[/code]

(Or rather, it puts them in the opposite order from the one you want, since higher description ranks get listed first.)

As climbingstars says, if all you want is to reorder the paragraphs, and if everything has a set description-rank instead of having to follow rules for it, you could just abandon Room Description Control and set the locale priorities.

climbingstars, I think my attempt with using the “Room Description Control by Emily Short” extension was a “quick and dirty” cosmetic coverup that didn’t work as well as I hoped it would. :blush: Thanks to both you and Matt for helping me find the correct technique that actually works, and is much easier to implement! :wink: :smiley:

Thanks yet again!

Cheers,

Here’s the transcript from climbingstars’ reworking of my initial example:

[i]Description Rank 01
An Interactive Example by Jay Goemmer
Release 1 / Serial number 121205 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Testing Lab
This is the testing lab.

Thing 2.

Thing 3.

Thing 4.

Thing 1.

[/i]

I was actually trying to bypass the paragraph breaks, and use the paragraphs to create the room description, like this transcript:

[i]Description Rank 02
An Interactive Example by Jay Goemmer
Release 1 / Serial number 121205 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD

Testing Lab
Thing 2.
Thing 3.
Thing 4.
Thing 1.

[/i]

And thanks to your help, here’s the source code I worked up to accomplish that:[code]“Description Rank 02” by Jay Goemmer

The story headline is “An Interactive Example”.

[ Reworked by climbingstars. ]

[ If you’re just looking to reorder the paragraphs, you can use this instead. ]

Rule for choosing notable locale objects for the testing lab:
set the locale priority of thing 1 to 4;
set the locale priority of thing 2 to 1;
set the locale priority of thing 3 to 2;
set the locale priority of thing 4 to 3.

The Testing Lab is A Room. [ The description of the testing lab is “This is the testing lab.” ]

The thing 1 is fixed in place in the testing lab. The description of the thing 1 is “[line break]This is Thing 1.”.

Rule for writing a paragraph about the thing 1: say “[line break]Thing 1.”

The thing 2 is fixed in place in the testing lab. The description of the thing 2 is “[line break]This is Thing 2.”.

Rule for writing a paragraph about the thing 2: say “Thing 2.[run paragraph on]”

The thing 3 is fixed in place in the testing lab. The description of the thing 3 is “[line break]This is Thing 3.”.

Rule for writing a paragraph about the thing 3: say “[line break]Thing 3.[run paragraph on]”

The thing 4 is fixed in place in the testing lab. The description of the thing 4 is “[line break]This is Thing 4.”.

Rule for writing a paragraph about the thing 4: say “[line break]Thing 4.[run paragraph on]”

[ 17.23. Listing nondescript items of something ]

Rule for listing nondescript items of the Testing Lab:
say “[run paragraph on]”.[/code]Thanks yet again!

While the solution you came up with does work, it seems a bit clumsy to me. To suppress the paragraph break after a single item’s paragraph, appeading “[no line break]” seems to be enough:

After choosing notable locale objects for the testing lab:
	if thing 1 is in the testing lab, set the locale priority of thing 1 to 4;
	if thing 2 is in the testing lab, set the locale priority of thing 2 to 1;
	if thing 3 is in the testing lab, set the locale priority of thing 3 to 2;
	if thing 4 is in the testing lab, set the locale priority of thing 4 to 3.

The Testing Lab is A Room. "This is the testing lab."
   
The thing 1 is in the testing lab. The description of the thing 1 is "This is Thing 1.".

Rule for writing a paragraph about the thing 1: say "Thing 1. [no line break]".
   
The thing 2 is in the testing lab. The description of the thing 2 is "This is Thing 2.".

Rule for writing a paragraph about the thing 2: say "Thing 2. [no line break]".
   
The thing 3 is in the testing lab. The description of the thing 3 is "This is Thing 3.".

Rule for writing a paragraph about the thing 3: say "Thing 3. [no line break]".
   
The thing 4 is in the testing lab. The description of the thing 4 is "This is Thing 4.".

Rule for writing a paragraph about the thing 4: say "Thing 4. [no line break]".

However, if you want to do this for all notable items in all rooms, it may be better to modify the “printing a locale paragraph about” rules instead:

For printing a locale paragraph about a thing (called the item)
	(this is the new offer items to writing a paragraph about rule):
	if the item is not mentioned:
		if a paragraph break is pending, say "[run paragraph on]"; [ <-- changed this from "[conditional paragraph break]" ]
		carry out the writing a paragraph about activity with the item;
		if a paragraph break is pending:
			increase the locale paragraph count by 1;
			now the item is mentioned;
			[ say "[command clarification break]"; ] [ <-- commented this out ]
	continue the activity.

The new offer items to writing a paragraph about rule is listed instead of the offer items to writing a paragraph about rule in the for printing a locale paragraph about rulebook.

The code above is the same as the original rule in the Standard Library, except for the two changes noted in the comments. The first change suppresses any pending paragraph breaks (and resets the flag, so that the subsequent test for it works as intended), while the second omits the break after the paragraph (but leaves it pending, so that we get the expected number of breaks at the end of the room description).

Finally, neither of the solutions above suppresses the paragraph break at the end of the room description itself; for that, you’ll need to override one more bit of the Standard Library:

To print the location's description:
	if the description of the location is not empty, say "[description of the location][line break][run paragraph on with special look spacing]".

(That looks a bit complicated, but seems to produce the expected results in all the cases I tested, both with and without any items in the room. For the specific test setting above, just “if the description of the location is not empty, say the description of the location.” would work just about as well.)

After experimenting with it some more, I have to agree with you. It seems to work fine for stationary objects, but if the player goes into one of the rooms that are specified, the “paragraph written” about the object shows up even if the player is carrying it! :astonished: :blush:

So I’ll have to figure out which method works best in which game. I’ll have to go back and try Room Description Control separately.

I’ll need to try the approach you suggested, as well. Thanks for posting the code! :wink: :smiley:

Cheers,