By default, Dialog’s fast-travel system (GO TO ROOM or FIND THING) prints all the normal text for each step of the journey. This sometimes means screens and screens of text for one command! How can we make that shorter?
First, we need a way to extract the last element of a list.
(split last element from [$Last] into [] and $Last)
(split last element from [$Head | $OldRest] into [$Head | $NewRest] and $Last)
(split last element from $OldRest into $NewRest and $Last)
Now, we can modify the GO TO code:
(perform [go to $Room])
(current room $Here)
(if) ($Here = $Room) (then)
You are already in (the $Room).
(tick) (stop)
(elseif) (shortest path from $Here to $Room is $FullPath) (then)
%% New stuff starts here!
(split last element from $FullPath into $Path and $LastStep)
%% First, do the main part of the path, suppressing room descriptions
(exhaust) {
*($Dir is one of $Path)
(line) \( (name $Dir) \) (line)
(now) (room description suppressed)
(try [go $Dir])
(tick)
(par)
}
%% Now, the last step of it, with full descriptions
(line) \( (name $LastStep) \) (line)
(try [go $LastStep])
%% The standard action rules will do the tick and par for us, we don’t have to
%% New stuff ends here
(else)
You can’t find any route from here to there on your map.
(tick) (stop)
(endif)
For every step of the path except the last one, we set the (room description suppressed)
flag before moving. Then we just have to look for this flag in the [look]
rules:
(perform [look])
(current player $Player)
($Player is $Rel $Loc)
(div @roomheader) (location headline)
(if) (room description suppressed) (then)
%% Nothing
(elseif) (player can see) (then)
(current scope ceiling $Ceil)
(look $Ceil)
(make appearances $Rel $Loc)
(par)
(else)
(narrate darkness)
(endif)
And reset the flag after a single tick, so that it only affects a single action.
(on every tick) %% This effect lasts only one tick
(now) ~(room description suppressed)
Now, GO TO ROOM will show only the header of each room you pass through, but the full description of the last one.
As a side effect, this also eliminates the one place in the library where (inhibit next tick)
is used. So you can trim that out entirely if you like!