Dynamic Passage Names? (Harlowe)

This is actually an additional topic that makes sense in context to a previous post: http://twinery.org/forum/discussion/4995/how-to-tell-harlowe-which-brackets-go-and-which-if-statements-go-to-which#latest

In the effort to make the links less predictable (Top link always goes here, Bottom always there) I tried making the passage names into vars. The problem is that what I did works - but it throws an error on screen anyway. Know how to remove the error?

{(set: $scene1 to (either: "SceneX","SceneY"))
(if: $scene1 == "SceneX")[(set: $scene2 to "SceneY")]
(elseif: $scene1 == "SceneY")[(set: $scene2 to "SceneX")]
}

{
(if: (random: 1,2) is 1)[
Choose Red or Blue <p>[[Red pill->$scene1]]<p>[[Blue pill->$scene2]]
](else:)[
Choose Green or Purple<p> [[Green pill->$scene1]]<p>
[[Purple pill->$scene2]]
]}

Error:
http://i.imgur.com/O0MvqXv.png

Comments

  • Try using a (link:) / (goto:) macro combination like the following:
    Choose Red or Blue <p>(link: "Red pill")[(goto: $scene1)]
    
  • Thanks for helping me out!
    Updated to this, but still getting the error message. Still works fine.
    {(set: $scene1 to (either: "SceneX","SceneY"))
    (if: $scene1 == "SceneX")[(set: $scene2 to "SceneY")]
    (elseif: $scene1 == "SceneY")[(set: $scene2 to "SceneX")]
    }
    
    {
    (if: (random: 1,2) is 1)[Choose Red or Blue <p>
    (link: "Red Pill")[(goto: $scene1)]<p>
    (link: "Blue Pill")[(goto: $scene2)]
    ]
    (else:)[Choose Green or Purple<p> 
    (link: "Green Pill")[(goto: $scene1)]<p>
    (link: "Purple Pill")[(goto: $scene2)]
    ]
    }
    
  • edited October 2015
    Replace both of your == with the is keyword:
    {(set: $scene1 to (either: "SceneX","SceneY"))
    (if: $scene1 is "SceneX")[(set: $scene2 to "SceneY")]
    (elseif: $scene1 is "SceneY")[(set: $scene2 to "SceneX")]
    }
    
    {
    (if: (random: 1,2) is 1)[Choose Red or Blue <p>
    (link: "Red Pill")[(goto: $scene1)]<p>
    (link: "Blue Pill")[(goto: $scene2)]
    ]
    (else:)[Choose Green or Purple<p> 
    (link: "Green Pill")[(goto: $scene1)]<p>
    (link: "Purple Pill")[(goto: $scene2)]
    ]
    }