Howdy, Stranger!

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

"Searching" for passages

Hi,

Is there a way in 2.0 Harlowe to provide users a search function, where they can type the title of a passage and jump to it? This would also require some sort of identifier (think passwords like in the days of SNES game saves) users can refer to in order to figure out where they are in a story.

Thanks,

Comments

  • edited July 2015
    You can try the following code in a passage you want to provide the search and go function:
    (set:$location to (prompt:"Type in the passage you want to go to"))
    
    (goto:$location)
    

    This works if they type in an actual passage name. If they don't (ie. if they type in something that is NOT a passage name) it returns an error.

    I don't know how to configure it to do actions upon an error, which would be helpful in this situation, but perhaps someone more experienced can help with that issue.
  • Simple @Feliwebwork with an if/else

    If their code is wrong then it gives them a default passage.

    More sneaky should be an either() with like 3 or 4 lame passages that get picked from at random as a punishment for cheating! Hah. Jk
  • Is there a way to add more arguments to this? Mostly to reward players who think of creative, hard to find passages, be kind to players who enter typos, and punish players who try to break the system.
  • If you made passages with misspelled names and basically had had them as
    (Display: ActualPassageNameHere)
    
    , that would work! You'd have to account for a lot of misspellings with this method, though, so it might not be a great idea if you're going to have a whole bunch of password passages.
  • Thanks for the idea. But in reality would the user be in the misspelled passage or would it redirect the user

    Perhaps instead simply if misspelled the user could just be redirected back to the passage they were in before?
  • I just posted something about this for Sugarcube for figuring out who the murder is and where the victim is. I figure the way I did it could also be used for what you want, or even for cheatcodes.

    The user types in the cheat code character name (or the killers) Joe Blow and is redirected to a different character gen screen than normal to enable God mode(or to the police station), or to a 'free' store or whatever. I think I read your post and it got me thinking about it. I don't know anything about Harlow and only looked at code for the first time 3 weeks ago, but I thought it worked well for what I needed it for. Hope it helps in some way.

    http://twinery.org/forum/discussion/3193/example-using-user-text-input-for-outcomes#latest
    macen101 wrote: »
    Thanks for the idea. But in reality would the user be in the misspelled passage or would it redirect the user

    Perhaps instead simply if misspelled the user could just be redirected back to the passage they were in before?
    --- I had a link in to redirect back to the "name the killer screen" in case of error.

    -thrown
  • edited November 2015
    Just an update for those interested. What i ended up using was variables to trigger how players proceed to different passages, rather than enter a passage name which can lead to errors and other not-so-nice things.

    So for example:

    (set $location to prompt:"Enter Something")

    (if $location contains "word" or contains "word2")[(goto:"Passage")]
    (else:)[(goto:"Passage2")]

    I'd also leave triggers in passages to set certain variables to true once you visit the passage in question. Then, later on, those triggers might connect into and impact these triggers to enter certain passages.
Sign In or Register to comment.