Hybrid Choices Update (now with major, cool new features!)

Hi, I know a few people use my extension now so I wanted to let people know I just issued an update to my Hybrid Choices extension. I’m pretty excited about the new features so I’ll outline them right here.

First is the ability to set page priorities, so you can always control at what stage a choice is displayed.

Second (and really, this is the one I’m pretty stoked about) is the ability to present objects directly as choices, along with pages. This lets you build choice lists that present, say, a list of all visible objects in the room rather than merely other pages that the page turns to.

The Colored Rooms example is a demonstration of fast travel using object choices. I learned at the last minute that I forgot to include the extension in the example, so you’ll need to do that to get it working properly.

The Line Up demonstrates how whole actions can be controlled through Object Choices.

I can easily conceive of using the system to set up whole new disambiguation systems and new ways of parsing games.

Here is the link. http://inform7.com/extensions/AW%20Freyr/Hybrid%20Choices/index.html

Awesome! Thanks!

The extension looks good but the examples are too hard to use.

  • There’s no ‘test me’ command for the examples
  • I don’t know what the eating a banana one is about. Typing ‘eat banana’ doesn’t work.
  • There’s that example which doesn’t include the extension
  • There’s an example which has no title in the code. This stops I7 putting an ‘include’ button for it in the IDE, which in turn means you need to cut and paste the text yourself. When you do that, you don’t have any real tab characters, so it doesn’t compile. If you replace the spaces with tab characters… well, I still couldn’t get it to compile. There was some formatting problem I couldn’t diagnose.

Should be very easy to fix all these, though.

-Wade

Oh, I love this extension! I’ve found it to work very well as it already is but I’ll definitely check out the new features for future projects.

I’m trying to get him to add a hook to the last object that was choice-selected, so you can do stuff like, say have a SKOOZLE spell, and when you type SKOOZLE you can have the extension make a list of all “skoozle-able” objects in scope and have the player pick one.

Similarly, you could break down parsing for new players so they could just type OPEN and be presented with a list of openable things in scope, then the “last selected” object can be acted upon with the normal action.

I’ve been trying to use this extension, but I’m encountering an odd issue. Even when using the test code in a blank game with one room:

After looking for the first time: switch to cyoa at p1. P1 is a page. P2 is a page. The cdesc is "P2". It is for P1. P3 is a page. The cdesc is "P3". It is for P2. P4 is a page. It is flipped to by P3. "Whoa. Interesting.". P5 is a page. It is flipped to by P4. "Damn man. That's crazy stuff." P6 is a page. The cdesc is "P6". It is for P5. It is a dead-end. "You've encountered something and ran away." P7 is a page. The cdesc is "P7". It is for p5. P8 is a page. The cdesc is "P8". It is for p5. It is inactive. "You aren't supposed to see this."

Every time a use a link or look, all of the options become repeated. Does anyone know why this would occur? I’m using version 4 with 6M62 .

I see the same issue:

I looked at the extension’s source code, and the problem is that the available choices are added to the table of choices, starting at the first blank row, whenever a look occurs (via refresh choices), but the table is only cleared when a selection is made. So, in the transcript above, because we’re not making a selection, the table is getting a duplicate of choice P2 added to it each time that we look.

Here’s one solution (rewriting some phrases in the extension):

To populate choice list with (n - an object):
	if n is a decision listed in the table of currently available choices, stop;
	choose a blank row from the table of currently available choices;
	now the decision entry is n;
	now the choice-order entry is the number produced by the choice-priority rules for n.

To populate choice list with (n - a description of objects):
	repeat with the item running through n:
		populate choice list with item.

To populate choice lists for (n - a page):
	repeat with K running through pages turned to by N:
		follow the choice-switch rules for K;
		unless rule failed:
			populate choice list with K;
	sort the table of currently available choices in choice-order order;
	repeat through the table of currently available choices:
		increment assigned index;
		now the index entry is the assigned index.

I rewrote the first phrase to avoid adding duplicate choices to the table, and I rewrote the other two phrases to call the first one instead of duplicating the code to add a choice to the table.