+2 votes
by (160 points)

Hi, very new user and first time question!

I have a page like this:

(Text)

[[Option 1]]
(if:$A is "on")[Here is a secret [[option 1a]]]
(if:$B is "on")[Here is a secret [[option 1b]]]
[[Option 2]]
[[Do something else.]]

Until the variables are set to "on", options 1a and 1b are hidden. But the user can still clearly see the blank space where they should go. I know I can collapse blank space using {}, but that also removes line breaks between the options and ruins the formatting.

I'm wondering if there's a way to TRULY hide an option such that everything within the brackets is reduced to nothing until $A is set to "on", at which point it is revealed, line breaks and all. Thanks!

2 Answers

0 votes
by (159k points)

The secret is to move the line-break you want the hidden text/option to have into the associated hook, and then to suppress the one after the end of the associated hook. That way the line-break is only added if the related condition is true.

(set: $A to "off")
(set: $B to "on")

(Text)

[[Option 1]]
(if: $A is "on")[Here is a secret [[option 1a]]
]\
(if: $B is "on")[Here is a secret [[option 1b]]
]\
[[Option 2]]
[[Do something else.]]

 

note: If your $A and $B variables are meant to represent a Boolean condition (on/off, yes/no, etc..) then it is generally better to use the Boolean true and false values rather than two String values.

(set: $A to true)
(set: $B to false)

(if: $A)[The A value is true.]
(if: not $B)[The B variable is false]

 

by (160 points)
Thank you! This was really helpful.
0 votes
by (170 points)

You can just use {} and do the formatting yourself. I found this the easiest solution. <br/> will create a line break for example.

(Text)

{[[Option 1]]<br/>
(if:$A is "on")[Here is a secret [[option 1a]]<br/>]
(if:$B is "on")[Here is a secret [[option 1b]]<br/>]}
[[Option 2]]
[[Do something else.]]

 

by (160 points)
This is also a really good solution! Thanks!
by (6.2k points)
Also, sorry about this not being related to the question, but where you have the secret links, it looks to me like it would be better if it just said [[option 1]]. If you do [[option 1 ->option 1a]], it would look like option 1 but take you to the option 1a passage. sorry if this wasn't helpful or you already knew it.
...