I have the code below, which is okay if you eliminate the “sort lvd in visyet order” command.
But I’d like it in, because otherwise you get “You can go north or south to room-that’s-south,” which is confusing.
However, Inform seems to think that I am trying to sort a table. What am I missing? Thanks!
check going nowhere:
carry out the exitlisting activity;
the rule succeeds;
exitlisting is an activity.
rule for exitlisting:
let lvd be list of viable directions;
sort lvd in visyet order;
say "You [if noun is diagonal]never need to use diagonal directions[else]can't go [noun][end if], [if number of viable directions is 0]and you may need to figure a puzzle to go anywhere[else]but you can go [lvd][end if].";
to determine what number is visyet of (x - a direction):
if the room x of location of player is visited, 0;
1;
after printing the name of a direction (called d) while exitlisting:
let rm be the room d of location of player;
if rm is visited, say " to [rm]";
Now, I’ve found an adequate solution with
rule for exitlisting:
let lvd be the list of viable-gone directions;
let lvd2 be the list of viable-not-gone directions;
add lvd2 to lvd;
say "You [if noun is diagonal]never need to use diagonal directions[else]can't go [noun][end if], [if number of viable directions is 0]and you may need to figure a puzzle to go anywhere[else]but you can go [lvd][end if].";
definition: a direction (called d) is viable-gone:
if d is viable and the room d of location of player is visited, yes;
no;
definition: a direction (called d) is viable-ungone:
if d is viable and the room d of location of player is unvisited, yes;
no;
But I suspect I am missing something about sorting and would love to know what it is.
Thanks!