Howdy, Stranger!

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

Arrays not retaining their array-ness when changing scenes.

edited May 2015 in Help! with 2.0
So, I have two scenes. At the start of the first scene, I create an array - to be precise, I create this:
(set: $people_in_office to (array:"the queen", "the queen's guards"))

I call $people_in_office's first just fine, as well as $people_in_office's length.

However, I transition to a new scene. $people_in_office still exists, and it still contains "the queen" and "the queen's guard". However, when I run it in debug mode, this message shows up where the function is called.
You can only use positions ('4th', 'last', '2nd-last', etc.) and 'length' with a an array.

But... it is an array. What do I do to fix this? And is it a problem with Twine itself, or something I'm doing wrong?

Comments

  • note: I am assuming you are are using the Harlowe story format because you did not indicate this in your question.
    I call $people_in_office's first just fine
    I assume you mean $people_in_office's 1st because $people_in_office's first will result in the error message you say you are seeing.

    I created two passages, the first passage has a link to the second as well as your (set:) macro. I then added the following three tests to both of these passages. The first and third test work correct and the second test correctly displays the error message as expected.

    Tests
    1st: (print: $people_in_office's 1st)
    first: (print: $people_in_office's first)
    length: (print: $people_in_office's length)
    

    Outputs
    1st: the queen
    first: You can only use positions ('4th', 'last', '2nd-last', etc.) and 'length' with a an array.
    length: 2
    
  • Yep, Harlowe.

    And I realize that me saying "first" was a mis-type. I've been using "1st" throughout the story.

    Anyway, I must've been calling it in the wrong way or something, because I tinkered with it a bit it's working now.

    Gotta love programming.
Sign In or Register to comment.