Howdy, Stranger!

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

Error from visitedTag function

Hello! This is my first post. I was playing with the visitedTag function and copied this line of code from the wiki:
<<print visitedTag("Swamp")>>
However I get the following error:

<<print>> bad expression: visitedTag("Swamp")



  • Do you have a tag called Swamp?  And are you used the "test play" feature, or building an HTML file, playing through the game, and then encountering that error message after going through a bunch of passages tagged Swamp?
  • Yes. I tagged with Swamp. No - I did NOT build an html, just used the test feature.
  • Although building an html I get the same error.
  • The test feature is pretty finicky.  A lot of times you'll get an error message using it even if there is no error with your Javascript.  But you're saying you built the HTML file and played it on your computer, going through a few rooms with that tag and it's still not working.  Can you upload the tws file using the "attachment and other options" below this comment box?
  • Ok. Here it is.
  • That's the HTML file -- could you post the tws file?  There's probably some piece of code missing from the game itself that is causing the error.
  • Whoops. So it is. Here you go.
  • There's a bug in the current version of the vanilla story formats which causes an error if you try to pass a singular string argument to visitedTag().  SugarCube does not have this error.

    As a workaround, you can simply use a single element array.  For example:
    should look below for the real workaround.
  • Actually it still doesn't work. No error is thrown, but the count stays at 0. Code attached.
  • Ah, yes, sorry.  I thought the vanilla version allowed arrays like SugarCube's, but I was mistaken.

    Okay, for realsies this time.  Checking for multiple tags is unaffected by the bug, so a working workaround (tested this time) is to specify the tag twice, like so:

    visitedTag("start", "start")
  • Yup! I confirm that works. Thanks Mad Exile!
Sign In or Register to comment.