New ChoiceScript features for programmers

choicescript-updates
#31

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.

#32

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
#33

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.

6 Likes
#34

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.

#35

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?

#36

I think you’re looking for this topic?

1 Like
#37

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
#38

@dfabulich
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!"
${twodimensionalarray[1][1]}

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

*set twodimensionalarray[1][1] "Hello again!"
${twodimensionalarray[1][1]}

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!"
#39

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

1 Like
#40

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

#41

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
#42

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

#43

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’

#44

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

#45

nested folders

#46

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

#47

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…

#48

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
#49

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

1 Like
#50

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

1 Like