Code Monkey home page Code Monkey logo

Comments (6)

NQNStudios avatar NQNStudios commented on August 26, 2024 1

I'm personally disinclined from hacking more syntax into hscript such as {&value1|value2|value3}. One of the reasons for that is I find the difference between &, !, ~, etc. very confusing in Ink to begin with, and I'd rather replace it with something instantly readable like {shuffle(...)} {onlyOnce(...)} that doesn't obfuscate the type of flow being invoked.

from hank.

NQNStudios avatar NQNStudios commented on August 26, 2024 1

After looking over the Ink tutorial again, I see that you're right--the sleek syntax for alternative sequences is pretty great. I think I'll refactor fillHExpressions() into a method fillBracketExpressions() which calls two separate functions depending on whether the bracket contents start with the symbol for an alternative sequence, or not, in which case it will be parsed as hscript like before. I'm planning to allow the single-character symbols Ink uses, and also versions like 'shuffle' for a shuffle, etc. if the author wants more readability.

from hank.

NQNStudios avatar NQNStudios commented on August 26, 2024 1

Closed by 088c22d. Let me know if there are any problems.

from hank.

zicklag avatar zicklag commented on August 26, 2024

I see your point, and I think that makes sense. Then we could just expose those functions in HScript without needing to change anything about the current implementation. That's a plus.

Still, there are a couple things I don't like about it:

  • You have to put your strings inside quotes for those functions, which means having to do escapes and things like that if you've got quotes inside of the strings. ( not a huge deal )
  • I don't think that would very well with nested alternatives. Obviously you can achieve the same effect in other ways, but you would have to write more Haxe which works against the average user that you want to be able to write hank.

Edit: Another issue is if you want to support redirects inside of alternatives. That wouldn't work either. The advantage of alternatives in Ink is that they contain actual Ink content that resolves just like any other line content.

I'm not against making the syntax more clear, but I'm not so sure that making it so that the only way to resolve alternatives is to use HScript is such a good idea. It makes it a little too programer-y and limits what you might be able to do without having to write Haxe.

from hank.

NQNStudios avatar NQNStudios commented on August 26, 2024

Two specifications from WritingWithInk.md that I predict will require careful attention:

Alternatives can be nested.

The Ratbear {&{wastes no time and |}swipes|scratches} {&at you|into your {&leg|arm|cheek}}.

Alternatives can include divert statements.

I {waited.|waited some more.|snoozed.|woke up and waited more.|gave up and left. -> leave_post_office}

from hank.

NQNStudios avatar NQNStudios commented on August 26, 2024

Turn this example into a testing example: https://github.com/inkle/ink/blob/master/Documentation/WritingWithInk.md#examples

from hank.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.