New ChoiceScript features for programmers


sorry again, but try this…

*create leadership 50
*create strength 50
*create hold_scene ""
*create hold_label ""

*set hold_scene "animal"
*set hold_label "claws"
*goto_scene WeaponSelect

This is where I’m stuck. I want to set the hold_ variables at different times and the error occurs.


OK, yeah, I reproduce this error now. Quicktest tests each scene in isolation; if you *create variables with invalid values without setting them to something valid within the current scene, a fake bug may occur.

But since my version works and yours doesn’t, I think a reasonable workaround is to *create hold_scene "dummy" where there’s an empty dummy.txt file to satisfy Quicktest.

1 Like

The ability to dynamically create an array would be really nice, copying and pasting hundreds of lines and manually changing the number is a real pain.

Maybe something like…

*create_array varName amount defaultvalue ?

*create_array soldier_ranks 20 "Private"

I also think the fact that you refer to an array like this[5] could confuse people when the actual variable is named/defined like this_5.

Other than that, these are all very useful features, a definite step in the right direction.
I’m looking very forward to using them.


I would like to use the new Array Syntax, but, a tad apprehensive if the syntax will change in the future. Has a final decision been made to keep the array syntax?

I agree that manually typing out the index numbers can be painful and you have my vote for Dynamic Array support. I’ve been using Spreadsheet App (Open Office Calc) as the Editor of choice working with ChoiceScript. Works quite well with consideration to the indention rules and lack of dynamic arrays. All I’m missing now is Syntax Highlighting. lol.


Could someone please help me out with the new spacing rules? Why are spaces after *if statements no longer working?

Two *line_break commands kind of work, but create a bigger space than I want. One *line_break is a single carriage return with no blank space (the same as it was before.) Blank lines don’t work at all. What’s the solution to manufacture a single blank line between paragraphs if you’re using *if statements?


I think you’re looking for this topic?

1 Like

Sorry for a little bit of a bump on this topic, but I’ve finally gotten around to using these features with a new project.

First off, again, I love these new features, but as others have said, the ability to either dynamically create an array, or do so with a one-liner like CJW suggested would be very useful. I had though I could compact things a little by using a loop, but since all the *create commands need to happen first, one can’t use a loop to set up an array.

1 Like

I’ve been trying out the array syntax with two dimensional arrays, and at first it seemed to work remarkably well (when printing values and even using two variables as the array indexes).
For some reason however the *set command seems to ignore the second pair of brackets?

Because whilst this works great:

*create twodimensionalarray_1_1 "Hello!"

This throws the error “Non-existent variable ‘twodimensionalarray_1’”

*set twodimensionalarray[1][1] "Hello again!"

In fact it actually appears to be ignoring everything after that first bracket pair as the following line throws the same error as above:

*set twodimensionalarray[1]_2 "Hello again!"

Good catch! It should be fixed now in the latest version of ChoiceScript up on Github.

1 Like

It seems the ‘long’ option of *input_text doesn’t work anymore, was this an accident caused by these changes?


Oh, yeah, I forgot about that completely. (I never documented it; I don’t think anybody’s ever used it.)

But it’s working again in the latest ChoiceScript up on github.

1 Like

I think it’s a useful feature, but true, I don’t think many people are aware of it.


Are square brackets okay to use? Apologies if I missed more recent posts on square brackets. I’m integrating some code I designed last year and having problems I don’t remember having when I last tested it.

My example is my line:

*gosub_scene phrase/adjectives weather[random_noun]

throwing up the error:
‘phrase/nouns line 148: Invalid expression; expected name, found OPERATOR at char 7’


What’s up with the division sign in the code?


nested folders


I thought we were only supposed to have text files in our scenes folder, and not other folders?


Works great. Picked it off a forum post a while ago because I had way to many files in there. Downside is its not compatible with some CSIDE features, so I don’t recommend using it.

Normal use example without square brackets: *goto_scene territory/two_kingdoms_riverrun_waybrook

But if you saw an official post saying don’t use them I’d appreciate a signpost…


Yea, that’s actually not an intended feature, and isn’t supported. (And I’d probably have to say to undo it for publication.)

1 Like

Thank you! Have removed all folder nesting and it runs without issue.

1 Like

To add: that is exactly why it is not compatible with CSIDE :slight_smile:

1 Like