Typescript/Svelte IF Framework

ChoiceScript doesn’t support negative numbers as literals because, in ChoiceScript, the leading operator is a shorthand for addition and subtraction from the current value.

*comment set foo to 40
*set foo 40
*comment add 40 to foo
*set foo +40
*comment that's equivalent to:
*set foo foo+40

*comment subtract 40 from foo
*set foo -40
*comment which is equivalent to:
*set foo foo-40

As a result, the only way to set foo directly to negative 40 is to *set foo 0-40, which is weird for anyone coming from typical programming languages.

It made sense at the time because in CS games, addition/subtraction are very common, and negative literals are relatively rare. Plus, CS users are mostly not familiar with other programming languages, so they wouldn’t necessarily come in with the same expectation as other programmers.

I think you’re going to run into a lot of issues like these trying to re-implement ChoiceScript. :sob:

It would really surprise me if ChoiceScript turns out to be the right answer for the problem you’re solving…

Why CodeMirror? (Is that what the Twine GUI JS editor uses?)

A related approach is to just not integrate with the Twine GUI editor at all, and just integrate with Twee. Twee actually has a specification, unlike ChoiceScript. https://github.com/iftechfoundation/twine-specs/blob/master/twee-3-specification.md

1 Like

Yes, Twine uses CodeMirror and allows story formats to provide editor extensions for it. It is used for the passages, and the story JS and CSS.

Again, the Twee format doesn’t really bring much to the table other than the passage system. I actually already made a Rust library and compiler for Twee back when I still thought making a story format was the best idea.

I read through the issue there is for that, and I understand you can’t use it in set command because that’d be ambiguous, but anyone that had high-school math would expect it’s valid to write something like (-2 + 7). It’s just weird that’s not possible. And set would be possible with (-2), that signals it’s the unary minus and not a set-and-subtract, and it gets rid of the confusing extra 0.

I picked out 3 issues I have: unary minus, operator precedence instead of parenthesizing absolutely everything (also something you’re not used to from regular maths), and a syntax for declaring proper functions that work like the built-in round: They get parameters and return a value, but don’t have choices or print anything. IIUC you can’t use commands in expressions, so you can’t use gosub or something like that for a reusable calculation that isn’t displayed.

With those changes, ChoiceScript is essentially a more beginner-friendly Ink, which is precisely what I want.

By the way, this quote:

Is what motivated me to work on keyboard accessibility yesterday. For touchscreen I’ll probably make an option that does something similar to ChoiceScript: Pulling all inline links out of the text, possible with the sentence they’re in or at least a bit of context and displaying a series of buttons for them after the passage. I’m determined there is a way to make an accessible cross-platform UI that’s at least a bit more pretty than the default ChoiceScript one.

1 Like

Could you instead use a larger font?

I though about that, but using a larger font would probably mess with the line spacing. Or do you mean use a larger font in general, so the links are bigger, too?

Is this a Perry Rhodan reference? It is a Perry Rhodan reference :smiley:

I have quite a large number of old Perry Rhodan paperbacks in English. You used to find them with some frequency in charity shops here, but I’ve not seen one in many many years. Maybe decades even.

2 Likes

Wow, I didn’t think anyone would actually get it. Perhaps my hint was too obvious? It’s at least the only big German sci-fi series I know of, and one of the longest running on earth if the publisher is to be believed. I know it’s translated, so there was a chance someone could know it. Though what I’m referencing is fairly deep in, it’s in the 1200s of the issues (Though there are more than 3000 to date, so it’s not even half).

My thinking is factoring links out of the main text to a separate area wastes valuable space and is confusing. Touchscreen text links work in browsers well enough, so why not in a game. Although font size might be factor. Yes, you’d change the size overall, not just the links.