Howdy, Stranger!

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

A question about variables

Apologies if this has been covered before. (I'm sure it has, but I havn't been able to find a solution.)

I have a list of variables, which all set to true on one passage. On the next passage I want something to trigger if they're all true, but it doesn't seem to work for me. I'm an absolute beginner so this might be a really stupid error i'm making.

First passage:

[Notebook]<notebook|
(click: ?notebook)[You grab your notebook from the desk. It's leather cover is battered, but it still has a fair few pages left.]
[Phone]<phone|
(click: ?phone)[You slip your mobile phone into your pocket. Let's hope the battery lasts.]
[Map]<map|
(click: ?map)[It's a folded map of the whole kingdom. Could be useful. (set: $map to true)]
[Violin]<violin|
(click: ?violin)[Larger, bulky and impractical for travel, but you can't seem to part with it. You strap the case to your back (set: $violin to true)]
[Bottle]<bottle|
(click: ?bottle)[You fill a small glass bottle with water and place it in your pack. (set: $bottle to true)]
[Shell]<shell|
(click: ?shell)[You don't really know why. It's just a shell. Probably from a scallop or something. You palm it and slide it into your pocket. (set: $shell to true)]
[Staff]<staff|
(click: ?staff)[A trusty and sturdy oak staff. A little on the heavy side, but it could make the journey a little easier. (set: $staff to true)]

Second passage:

(if: $notebook is true and $phone is true and $map is true and $violin is true and $bottle is true and $shell is true and $staff is true)[You're weighed down by so much of this place. The journey is going to be difficult]


What am I missing?

Comments

  • In the above code, you didn't set $notebook or $phone to true.
  • No wonder they call you @Sharpe. Your freakin eye is sharp, I'll tell you that.

    I didn't even see that and I stared and stared at it.

    Awesome.
  • Thank you so much! Turns out I'm just sloppy in my proofreading!
  • Tell me about it! I get paid professionally to edit—have for years!

    Shame.

    Damn.
    Crying.
    Shame.


    :)
  • @HauntedCity: You should also assign a value of false to these $variables before your first passage because by default they actually equal zero not false.

    It is a good idea to assign default values to all your $variables at the start of your story, you can do this in Harlowe 1.1.1 by first creating a new passage (it's name is not important but I would name it something like Startup), then assign this new passage a tag of startup, and finally place code within this new passage like the following:
    (set: $notebook to false)
    (set: $phone to false)
    (set: $map to false)
    (set: $violin to false)
    
Sign In or Register to comment.