Hi,
Newbie here.
I'm using Harlowe and I'm trying to trim the exit links of passages in a Twine-based book so that they only show passages that the reader hasn't already visited.
I've tried both the following:
(unless: ((history:) contains "Check the manacles 46"))[[Check the manacles->Check the manacles 46]]
(if: (history:) contains "Check the manacles 46")[](else:)[[Check the manacles->Check the manacles 46]]
But for the case where the passage 'Check the manacles 46' hasn't previously been visited, I get the following results (where the first line is the current history):
Start,The Awakening,Look at cell 46
The (unless:) command should be assigned to a variable or attached to a hook.->Check the manacles
The (else:) command should be assigned to a variable or attached to a hook.->Check the manacles
The test to see if a string is in the history (as follows) works fine.
(if: (history:) contains "Look at cell 46")[Found the string]
I'm really surprised that the second piece of code doesn't work, as that is just a simple example of what the (else:) macro is supposed to do, isn't it?
The only strange thing that I can see in the code, is that the colour of the number in the text string I am using for the test is different to the rest of the text in the string, which I don't understand seeing as it is also inside the quotes and should be being treated as text rather than a number. However, It is also a different colour in the standard if test line of code, which works fine, so a data typing mismatch problem can't be the cause the problem.
Anyway, if anyone can shed light on this problem, it would be very much appreciated. And, I'm quite willing to be told I'm doing something stupid here, because I'm new to the language.
I'm also happy to try an alternate approach, if there's a better one available in the language.
Cheers.
phillberrie.
Newbie here.
I'm using Harlowe and I'm trying to trim the exit links of passages in a Twine-based book so that they only show passages that the reader hasn't already visited.
I've tried both the following:
(unless: ((history:) contains "Check the manacles 46"))[[Check the manacles->Check the manacles 46]]
(if: (history:) contains "Check the manacles 46")[](else:)[[Check the manacles->Check the manacles 46]]
But for the case where the passage 'Check the manacles 46' hasn't previously been visited, I get the following results (where the first line is the current history):
Start,The Awakening,Look at cell 46
The (unless:) command should be assigned to a variable or attached to a hook.->Check the manacles
The (else:) command should be assigned to a variable or attached to a hook.->Check the manacles
The test to see if a string is in the history (as follows) works fine.
(if: (history:) contains "Look at cell 46")[Found the string]
I'm really surprised that the second piece of code doesn't work, as that is just a simple example of what the (else:) macro is supposed to do, isn't it?
The only strange thing that I can see in the code, is that the colour of the number in the text string I am using for the test is different to the rest of the text in the string, which I don't understand seeing as it is also inside the quotes and should be being treated as text rather than a number. However, It is also a different colour in the standard if test line of code, which works fine, so a data typing mismatch problem can't be the cause the problem.
Anyway, if anyone can shed light on this problem, it would be very much appreciated. And, I'm quite willing to be told I'm doing something stupid here, because I'm new to the language.
I'm also happy to try an alternate approach, if there's a better one available in the language.
Cheers.
phillberrie.