How to check cycling choice value

Hi,
So I’m creating a passage in which the player has to match up the values of the two cycling choices. Both of them have a bound variable. Both variables should have correct values for the player to progress to the next passage, but when I run the code, it won’t work. Here’s the code:

(cycling-link: bind $subject, "Boy", "Bird", "Lady", "Spiders")

(cycling_link: bind $cause, "window", "stomping", "failiure", "fall")

(if: ("Boy" is in $subject) and ("failiure" is in $cause))[(goto: "a-boy")]
2 Likes

There are a couple of issues with your example:

  1. The macro name of the second (cycling-link:) macro call is incorrectly spelt, you have an underscore instead of a standard dash.

  2. The (if:) macro in your Passage is evaluated during the process that converts the viewed passage’s content into the HTML that will be displayed on the page, and this occurs before the end-user has a chance to interact with the two Cycling Links within the same passage. This means that the values of the two variable equal “Bob” and “window” respectively at the time the (if:) macro is processed.
    There are a number of techniques you can use to get the (if:) macro to be evaluated after the end-user has had a chance to interact with the Cycling Links, the simplest is to move that (if:) macro to the next passage viewed by the end-user.

  3. You are using the String is in operator, which is used to determine if one String value is a sub-string of another String value. It would be simpler to use the is operator instead

(if: $subject is "Boy" and $cause is "failiure")[(goto: "a-boy")]