I’m putting together a short workshop on writing in Choicescript for an online convention, and I’d be curious to hear what aspects of Choicescript you struggle with, especially concepts and features you wrestled with early on in writing games.
I’d say I get a p quick and good grasp on how CS functions. The parts I was stumbling around that time was probably nested reference and the
*params command for
Many of our community members have trouble grasping the “opposite pair” variable –
I, personally had trouble with the multireplace, until the limits of the mechanic was brought into greater focus.
Here is what I wrote in December 2020:
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!
Short answer: one bracket per expression.
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!
Think of an expression as an operation between two values/variables.
Operations include arithmetic and logic operations.
((5 + 2) = 7) ------------ true
These are great suggestions, thanks!
There’s something else I’m wondering:
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
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.
The one thing I struggled with most was understanding the difference between
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.
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.
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.
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?
I haven’t tried that yet, but I’ll do now
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.
But what if I call a subroutine recursively, does my variables bleed through each iteration?
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).
That’s awesome. I started writing a parser in Antlr, but getting the indentation right is very tricky.
That’s very accurate . 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.