I'm having a bit of a problem with how sometimes with code I'll have a large spat of empty space, just from the number of options available.
For instance, let's say I let the player decide what the value of $variable is.
Hello there.
<<if $variable = 1>>
Show this sentence
<<endif>>
<<if $variable = 2>>
Show this sentence
<<endif>>
<<if $variable = 3>>
Show this sentence
<<endif>>
Now, if the player chooses 3, they're going to have a long blank space where the code for 1 and 2 is. The code there will not be visible because the player chose 3, but even though it's "hidden from view", the space it takes up is still there and makes it rather unappealing. The passage would basically look like this from the players POV.
Hello there.
Show this sentence
Whereas I'd rather it look something more like this.
Hello there.
Show this sentence
Is there a way to make this possible? Any help is greatly appreciated.
Comments
for instance
You have <<print $people>> doing <<print $task>>
You have <<print $people>> doing <<print $task2>>
You have <<print $people>> doing <<print $task3>>
But task2 and task3 are not yet available in the game, so I don't think they should be visible, even as "0 peole doing task2".
So it would be more like
<<if $task2Available = 1>> You have <<print $people>> doing <<print $task2>><<endif>>
Which would have to be invisible, and again, would be a long black empty space. Especially if its on a stat menu, it'd be very obvious how much stuff is not being shown but exists because of the large black space.
The <<nobr>> command will not work because then everything would be just on one line, and that's also not what I want.
If only one out of a set of conditions may be true, then you could simply do something like this:
If multiple conditions may be true, then you could do something like this (using line continuations):
The setup for the tasks listing would be similar (again, using line continuations):
I noticed for the last example, $task1Available and the others weren't assigned a value. Could you explain how I'd execute this (what value $task1-3Available would have to be to register a true or false), and the syntax behind the line continuations?
What you meant to say was that I wasn't testing the $variables against a value. As to why, I didn't include a value because I assumed you were using them as booleans (i.e. true/false, on/off, yes/no). If that's not the case, then you can simply use the conditional expressions you were using before.
As to what you'd assign to them to be able to use them that way, you'd probably want to use the true and false boolean literals. For example:
TL;DR: If you're using $variables as booleans, then use real boolean values and simply use the $variables as-is in conditional expressions.
I was able to set this feature up in the right respect within my story, and got it to work exactly how I imagined it to be. I've also inadvertently learned far more efficient means for code syntax from your examples, such as you can set more than one variable within the same bracket.
Thank you very much!