0 votes
by (260 points)

Using Harlowe and want to display a text only if a player has already seen the passage once. Seems like the is no visited-function in Harlowe? This does not work, and I don't know why:

 

(set: $myPassageName to (print:(passage:)'s name))

variablecheck --> (print: ($myPassageName))

(if: (history:) contains $myPassageName)[WELCOME BACK]
(else:)[HI STRANGER]

 

However, not using a variable above solves it by using the following:

(if: (history:) contains "hereIputTheNameofThePassage")[WELCOME BACK]
(else:)[HI STRANGER]

My issue is that I really want to use a variable for the contains-check for the passage name, so I can recycle the script in any passage, instead of having to write it manually like in the above example.

Summed up: I need the simplest way to check if a passage has been visited. and depending on that, display different text.

2 Answers

+1 vote
by (159k points)
selected by
 
Best answer

The reason your first example doesn't work is because the purpose of the (print:) macro is to output any value passed to it as text on the page. So what your assignment is ready doing is saving the Command to print the current passage's name, and not saving the String value of current passage's name. Simply removing the (print:) macro from your example would result in it working as you want it to.

(set: $myPassageName to (passage:)'s name)
variablecheck --> (print: ($myPassageName))

(if: (history:) contains $myPassageName)[WELCOME BACK]
(else:)[HI STRANGER]

 

by (260 points)
Works. Thanks!
0 votes
by (6.2k points)

OK.. you're overcomplicating this waayyy too much.

(if: $ppassageNameVisted is 0)[(set: $ppassageNameVisted to 1)Hello stranger.](else:)[Welcome back!]

 

...