(visited:"Passage")
(visited: String) -> Command
A command that returns true of the named passage has been visited. If the input name is not a valid passage name, an error is produced.
Example usage
My brother Sam is an electrical engineer. He lives with his wife and child in District Five. (unless: ($visited:"Dinner with Sam and family"))[I can't wait to see him again! ]
Rationale
While "(history:) contains "Passage"" is similar, there are two differences:
-
The current passage is not in (history:) so if you write generic passages to be included with (display:) you will need a longer construction like (if: (history:) contains "Passage" or (passage:)'s name is "Passage") to include that case.
-
If you mistype the string with the name of the passage (e.g. if you rename a passage), the code breaks silently.
Details
Sample implementation:
(set: $visited to (macro: str-type _passage, [ (set: _result to false) (if: _passage is in (history:)) [(set: _result to true)] (else-if: (passage:)'s name is _passage) [(set: _result to true)] (else:) [(set: _temp to (passage: _passage)'s name)] (output-data: _result) ]))