New ChoiceScript Features

I don’t think these have been posted on the forums, but here are new features Dan added recently. To use them, you need the latest version of ChoiceScript from github.

IF NOT
Allows you to check for a false boolean.

*if not(variable)
stuff

ROUNDING
You can now round numbers to the nearest integer. For example, this will set foo to 3:
*set foo round(2.5)

INPUT NUMBER
There’s a new *input_number command, which only allows the user to type in numbers. (On mobile devices, it will automatically use the numeric keyboard by default.)

MODULO
You can now use the modulo operator % to calculate remainders. Modulo is pretty weird, but it has two particularly interesting uses.

First, you check whether a number X is evenly divisible by a number Y by checking whether X % Y = 0.

Second, you can use it to get the fractional part of a number X, the stuff that comes after the decimal point, by calculating X % 1. For example, 3.14 % 1 = 0.14.

So, wait… we can do modulo now, but still can’t bold or italicize? It doesn’t behoove one to complain too loudly about a free product, but these are text games we’re talking about.

I’ll definitely use if not and rounding, though.