Closed micabytes closed 8 years ago
Also an interesting wrinkle I've noted.
Your conditional choice syntax, is basically:
* { variable } Some text
This seems to have the side-effect that one can't insert variables or functions into the front of a choice. The following is invalid:
* { print_num(price) } dollars? Think of my seven children...
As is the following
+ { gavel_hit < 3} {&Going once|Going twice|Gone} -> gavel_hit
Since the second is assumed to be a conditional as well.
Working as designed, I expect, though at least the second case could conceivably be handled by the parser. Assuming you've encountered this issue in your writings, how do you typically work around them?
Also, I'm a bit surprised that this is legal:
* { true }
{ true }
three
Okaaaay, tackling each in order...
*/
. The reason being, to allow you to comment something out in the middle of the line. You may have noticed that the way we handle this is via two passes: first a separate whitespace-elimination parser is run, and then the main one is run.Yeah, we hit that wrinkle too, and there's a couple of ways round it.:
Simple repetition (if convenient). i.e. put the same content within square brackets as well as after them:
* {condition} [{logic} Hello] {logic} Hello world
Escape a space. Hacky, but not awful (and kinda looks like a separator right? :) ...
* {condition} \ {logic} Hello []world
Neither of these is beautiful, but it's a fairly unusual edge case, so we're pretty happy overall with it.
Hadn't noticed that point about the comments. But makes sense. Must have misunderstood that earlier comment.
I thought about the repetition solution as well as the "obvious", if inelegant, solution. I'd assume you're right about it being a rare edge-case, though - it's just something I fell across as I was working through implementing examples as tests.
The multiple conditions thing is fine. The multi-line thing is annoying from a parsing POV, because it is inconsistent with how things work in every other aspect of the Ink syntax.
As mentioned, I'm tinkering with an Ink implementation in Java, and it sounds like someone else might do something in Javascript (though perhaps it might make sense to join forces for that - depending on the implementation, a JS client could use the Java code).
Anyway, if it's OK, it might be useful to have a thread for questions/clarifications about the script intents. I've already run into a few things which are not covered in the docs.