numberconversion
*if number = 1
one
*elseif number = 2
two
*elseif number = 3
three
*elseif number = 4
four
*elseif number = 5
five
*elseif number = 6
six
*else
${number}
*return
Of course, that would work but would be a hassle if I wanted to print larger numbers like “seventeen” or “forty-five”. Short of writing a complete number-rendering subroutine, is there an inbuilt or easier way of doing this?
Pretty sure there’s not – but that would also be something I’d warmly support in a future ChoiceScript version, as a writer who gets stylistically offended when numerals pop up in the wrong places.
Not that I know of, either. One of those things that manually takes way more code than it feels like it should, but there is a functional work around, it’s just a pain. Honestly, it looks like your example handles it pretty much the same way I would if I were looking to put a similar feature in one of my games.
An array would work but it would have to go up to 20, after 20 though you would have to use JoJo’s format so that you could combine the words from the 1st and 2nd number to get 2 = Twenty, 1 = One
That would make 21 = Twenty-One
This would still only work up to 99 though and after that you would have to add even more to the code. Your code for 1-19 seems like it would work (if a little lengthy) and if you wanted to do 1-99 you could manage that with a little extra code but its a lot of effort for something that is purely aesthetic. Is it worth the time?