Choicescript concepts you struggled with?

I still don’t properly understand how many brackets to put around variables when you have more than one condition to be checked by an “if” statement. I literally just guess, run Quicktest, and if it doesn’t work start randomly adding and deleting brackets until it does!

11 Likes

Short answer: one bracket per expression. :grin:

Yeah, I get that that’s the basic idea, but it never seems to work like that for me. I never run into problems checking just two variables, but if it’s three or more, all bets are off and it’s guessin’ time!

1 Like

Think of an expression as an operation between two values/variables.

Operations include arithmetic and logic operations.

((5 + 2) = 7)
------------
true
1 Like

These are great suggestions, thanks!

There’s something else I’m wondering:

Do you use implicit_flow_control?
  • Yes
  • No

0 voters

Any specificities such as if we use ICF on the WIP we’re currently working on or on works we already published?

I’d love to hear them!

I’ve got mixed feelings about ICF and whether it makes life harder for new writers by making it possible to miss that you’ve messed up your indents, or easier because you don’t have to sprinkle *gotos and *labels everywhere.

4 Likes

I’m obviously in the latter group. With proper documentation (and noting non-ICF setup as some kind of legacy), indentation error you mentioned shoid be easily avoided.

1 Like

The one thing I struggled with most was understanding the difference between else and elseif.

6 Likes

I’d argue it’s a crutch that you’re almost always going to want to throw away eventually, so it’ll be easier to start with it off (on?) from the get-go if you’ve got some help/instruction.

4 Likes

If there’s a chance/time to mention why save is not supported by default (How to make save/loads? - #14 by dfabulich), I think you can explain it so new writers/coders will know what to expect going in.

3 Likes

I’ll second struggling with knowing how many parenthesis to put in with multiple conditions. I’m also wondering whether this presentation will be public, and where we might tune into it.

2 Likes

I just remembered something: scope. I had a hard time to understand scope in ChoiceScript and how far variables can be seen.

Temporary variables should be called local or private variables. They are not only temporary but they cannot bee seen from outside the scope of the scene. But what if I call a subroutine recursively, does my variables bleed through each iteration? :thinking:

I haven’t tried that yet, but I’ll do now :joy:

3 Likes

Only most of it. Especially the really complex and technical stuff, like indenting. That kicked my keyster for weeks at first.

Yeah, I’m not what you’d call programming-savvy. Two released titles and I still only understand about half of what y’all are talking about at any given time.

3 Likes

But what if I call a subroutine recursively, does my variables bleed through each iteration? :thinking:

Yes, they do. You have to be very careful in order to get recursion (or just subroutines) right. If one of your params is named like a variable, you will overwrite it.

Things I struggled with: ICF, 1-based index, scoping, inconsistent rules on braces.

Compared to other programming languages, CS is an unforgiving tool to use, with no scoping, no loops, no arrays, no functions. It really feels like coding on an old 8-bit machine, where you have an Assembler or a limited BASIC (and that’s why I wrote my own compiler).

3 Likes

That’s awesome. I started writing a parser in Antlr, but getting the indentation right is very tricky.

That’s very accurate :joy:. I wrote helping scenes with subroutines to extend ChoiceScript core functionalities in vanilla ChoiceScript, similar to Twiger_Fluff’s.

The only recursive subroutine I wrote was to get the greatest common denominator, and the scope wasn’t a problem because only the last value really matters. But I’ll have to keep the scope in mind now.

I was mildly curious about the scope then, but since the routine passed my unit test I just shrugged it off.

I’ll be giving it as part of Flights of Foundry, an online convention in April. I don’t know if it’ll be videoed and released like their panels and talks will be, but I’ll check.

If you ever go back to that and get it working, I’d be very interested. My VS Code extension uses a hand-rolled limited parser that mimics CS’s internals; an parser generated from grammar rules would let me simplify that greatly and make the extension more maintainable long-term.

2 Likes

If I do, it will be somewhat opinionated, since I was writing mostly for myself. For example, ChoiceScript actually allows labels to contain any character, but I was using the same definition of identifier as for variables, which is more restricted.

A post was split to a new topic: Flights of Foundry Free Virtual Convention

Mods, I’m wondering if we should pull my message about the workshop out into its own thread, since this thread started as an information-gathering thing and its title doesn’t really communicate that a ChoiceScript workshop’s available.

Edit to add: Thanks for doing that, @Eiwynn!

1 Like