Howdy, Stranger!

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

How to (display:) a passage when a condition is met, and remove it when the condition is not met?

edited May 2016 in Help! with 2.0
so, i got this:
$males
$females
$babies

(link: "Make Males")[(set: $males to it + 1)] <!--adds 1 to $males-->
(link: "Make Females")[(set: $females to it + 1)] <!--adds 1 to $females-->

that's in a passage, and this in another:
(link: "Make Babies")[(set: $babies to it + 1)] <!--adds 1 to $babies-->

now, i want to say if the $males = 1 and the $females = 1 then (display:) the second passage and if any of the $'s is less than what the condition requires then hide the (display:) of the second passage.

Comments

  • note: you don't state what the name of the second passage is, so I will just use "Name of second passage" which you will need to replace with the actual name of the second passage.

    You can use an (if:) macro combined with a (display:) macro to conditionally show something. The Boolean data section lists some of the operators you can use to compare the two values. (variable vs literal)

    The following will display the second passage if both variables are equal to 1, otherwise nothing will be displayed.
    (if: $males is 1 and $females is 1)[(display: "Name of second passage")]
    

    Your second request does not state which variables or what the required condition is, so I am going to assume you mean the same two variables and the same value as your first request.

    The following will not display the second passage if either variable is less than 1, but it will display it if both variables are equal to 1 or more.
    (if: $males >= 1 and $females >= 1)[(display: "Name of second passage")]
    
  • thanks, it worked just like what i dreamt it would.
Sign In or Register to comment.