In the latest version of ChoiceScript available on github, there are new features for you to try.
-
Change text size/color. You can now change the size and color of text, as we announced a few days ago. There’s a new “Settings” button which exposes the new options.
-
Multireplace. There’s a new way to insert text based on variables,
@{}
. (I’m calling it “multireplace” for now, but maybe somebody else will come up with a better name for it.)
It’s a little bit like ${}
replacement, but you give it a variable and a list of options. The variable must be either a number or “true”/“false” (true=1, false=2). @{}
will insert the option corresponding to the number.
There @{count is one thing|are two things|are three things} here.
You are on the @{is_evil Dark|Light} Side of the Force.
Behold the dragon@{plural s|}!
Behold the dragon@{(dragons > 1) s|}!
Behold the dragon@{(dragons = 1) |s}!
The first word should be a variable name, followed by a space, and then a number of options separated by vertical pipes |
. Empty options are allowed. You can also use more complex expressions by wrapping them in parentheses.
Note that the first option is numbered #1. If you want the first option to be zero, add 1 to the variable in parentheses, like this:
There @{(count+1) are no things|is one thing|are two things} here.
You can nest ${}
replacements in @{}
but you can’t nest @{}
inside another @{}
.
- Hyphen spacing. Now, ending a line with a hyphen or a longer dash “—” will not insert an extra space at the end of the line.
So if you write code like this:
All
one
line,
separate
words.
This-
is-
all-
one-
word.
ChoiceScript will display it like this:
All one line, separate words.
This-is-all-one-word.
Note that our Style Guide explains that dashes between words should have no spaces before and after, e.g. “There’s a dragon behind you—you should run.” The new hyphen spacing will make it easier to follow that rule.
Enjoy!