Howdy, Stranger!

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

Using datamap key/value as passage name?

For Harlowe:
(set: $character to (datamap: "Name", "Joe"))

In Twine, I have a passage named
$character's Name

and I am linking to the passage with:
(print: "[[" + $character's Name + "]]")

The Link is correctly being printed as "Joe", but it does not resolve to the a passage titled
$character's Name

I would like to avoid having to name the passage
Joe

Is this possible?

Thanks!

Comments

  • Generally it is not a good idea to include extended characters like punctuation in Passage names, because those characters can have special meaning in story formats.

    I suggest renaming your "$character's Name" passage something generic like "Character Sheet" and using code like the following to create your link:
    (print: "[[" + $character's Name + "->Character Sheet]]")
    
  • Thanks for the reply!

    I have multiple characters, so they each need to have their own sheet. I was hoping to avoid "hardcoding" their names anywhere -- including titles of passages -- in the event I wanted to change a name later so that I could just change it one place.

    I just realized, though, that passages have to be uniquely named, I think, so my plan wasn't going to work anyway.

    Thanks again!
Sign In or Register to comment.