I have a working direction menu which stores the directions and locations in the passage tags:
(set: $tagDir to (a: (passage:)'s tags))
(if: not(($tagDir[0][1]) is "X" or it is ""))[(print: "↑"+"[["+$tagDir[0][1]+"]]")]
etc.
And it works, as long as I create an entry for every direction in order, otherwise ...
If there isn't an "X" or a location name it complains:
an empty variable isn't the same type of data as the string "]]"
My tags will only allow one "X" so that didn't work, so I was wondering if there was a simple way in the
(if:) line that I'm missing?
Comments
I wanted to detect when there was an end to the locations in the tags. I can do that with a symbol if I need to, but maybe I need to change the way I'm implement the locations.
Maybe something like this -
tags - "hut","↓","parlour","→","garden"
Of course that doesn't quite work either. I could do an array at the start, but I may yet add or change some locations.
(note: I am using Twee notation, lines starting with :: indicate a new passage, the :: is followed by the passage name, and any tags are contained within square brackets)
a. Based on the output of No Tags the (passage:)'s tags seems to be returns an array which always has at least one element, which seems to be an empty string if there were no tags.
b. The (set: $tagDir to (a: $tags)) line in my example (equal to the (set: $tagDir to (a: (passage:)'s tags)) line in your example) is creating the equivalent of a two dimensional array (an outer array in which each item is an array)
So based on this and the fact your direction tags appear to come in pairs I would first wrap your logic in a conditional something like the following:
:: Directions [start test1 test2 test3]
Thanks again for your help.
I put a room number in each tag: 1, 2, 3, etc.
& An Exits passage that appears in my sidebar:
This works well.