About my ChoiceScript dialect (fewer gotos and gosub arguments)

Just a small update here - these ChoiceScript modifications are basically done but just awaiting some code blessings from Dan. He tells me I’m somewhere in the middle of his queue. I don’t really know how big the queue is, though. My guess is, big.

But, when it’s all done there should be a global implicit_control_flow flag where, if it’s set to true, if/else and choice don’t complain at you for leaving out the gotos; and also, a label followed by the “params” command will take arguments like so:


*label increase
*params stat bump
(Gained ${bump} $!{stat})
*setref stat ({stat} + bump)
*return

so you can just say

*gosub increase “coolness” 3

to both increase the “coolness” stat and announce it, for example. (This isn’t exactly how my own stat bump subs work, but it’s close enough for demo purposes.) This will work for gosub_scene as well, which is also a hack to get local scope if you want it (I guess you don’t if you’re not sure what that is).

7 Likes

I’ve got 150 lines of code devoted to stat bump subroutines…not sure whether to rejoice or groan that I spent so much time on it already! :expressionless:
Thanks for suggesting these changes! Any hope of getting some kind of array command, or should I start figuring out the long way around that, too? :smirk:

Well, you’ll be able to pass in additional anonymous arguments to gosub beyond the ones named in params, and be able to implicitly access those like an array. There’s probably a hack in there somewhere for you.

1 Like

Look at the multi-replace functionality for array stuff.
It can be done.