Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Password input not working

Hi,
I am working in Harlowe at the moment and I am pretty new to programming. I am trying to have the players input the right password so that they can go on. If they don't get the password right they end up back at the passage that asks for the password.
ALSO
I am trying to have the input come up by clicking a link. Once the player has gotten the password right, i want the link to be replaced by another link so that they won't need to retype the password everytime they come to this passage.

Here is what I have so far:

(set: $eno to (goto: "HOME"))\
(set: $adams to (goto: "John Adams"))\
(link: "PLAY")[(set: $password to (prompt: "Serial #:"))\
(if: $password is "secret")$adams,(else:)$eno]\

Comments

  • To add on top of that, I have specific passages that people can visit, and after they have visited those specific passages in a specific order, the players don't need to input the password anymore. I don't know how i might be able to do that. PLEASE HELP ME! D:
  • note: The following examples will contain extra indentation and line-breaks to make them more readable, this will add extra blank lines to the output so you should remove them in your copies of them.

    You can use a variable to control if your check password code is executed or not.

    1. Initialise the variable in your story's startup tagged special passage.
    (set: $knowsPassword to false)
    

    2. In your Check Password passage use the variable to determine if you check the password or display the other link.
    (if: $knowsPassword)[
    	[[Other Link->Other Passage]]
    ](else:)[
    	(link-repeat: "PLAY")[
    		(set: $password to (prompt: "Serial #:"))
    		(if: $password is "secret")[
    			(set: $knowsPassword to true)
    			(goto: "John Adams")
    		](else:)[
    			(replace: ?msg)[Wrong, try again]
    		]
    	]
    	[]<msg|
    ]
    
    ... notice I use a (link-repeat:) macro to allow the Reader to retry entering the password without needing to re-show the current passage again and again (which pollutes/pads the story History), and a named hook combined with a (replace:) macro to show an error.
Sign In or Register to comment.