GithubHelp home page GithubHelp logo

kyperbelt / yarngdx Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 4.0 583 KB

YarnGdx is a Libgdx Library for interactive dialogue in games! This is a port of [YarnSpinner](https://github.com/thesecretlab/YarnSpinner) by thesecretlab

License: MIT License

Java 95.87% Shell 0.15% ANTLR 3.97%
yarn libgdx-library libgdx twine game dialogue-systems dialogue-manager

yarngdx's Issues

android target - Lexer$TokeniserException - Lexer.java can't parse tokens following '<<' or '[[' -

Kudos on this fantastic library - when compiling for a desktop target, it works great! I created my own experiment, which is kind of a refactored version of the included demo.

https://github.com/jojomickymack/yarn_dialog01

When compiling for an android target, however, anything that's not a text token will throw a 'TokeniserException' when the json or yarn.txt file is getting loaded. I reduced a script to starting with

<<if visited("Gravedigger") is true>>

(Gravedigger is the name of the node) and this is what I see

desktop

trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
true
rule.type
If
line:1 col:4 text:if

android

trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
I/System.out: rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
false

The regex '\Gif(?!\w)' which is supposed to match the 'if' following the '<<' is not matching like it does when loading successfully on desktop. I believe that this is because of android's java 1.6 vs the desktop's java 1.8 and support for the regex '\G' flag - I see when I remove it from the 'addTransition' method, I'm able to match the if and everything else in the expression, but run into other issues.

I think this issue is fixable using a different system of parsing the line without relying on the \G (global - this means that the match is supposed to immediately follow the previous match - i.e - only when 'if' follows '<<' should this be true).

I'll play around with it - I'd really like to see this work for android as well as desktop since this is such a cool way of handling dialog trees.

integer is marked as unused

@SuppressWarnings("unused")

One way to tackle this would be to try{...} catch{...} outside the for loop rather than inside of it - declaring the incrementing variable inside the try block.

We need the info in catch to properly log debugs, so my idea is that a reference of the last investigated node should be stored in the method scope

Colors Issue

Hi guys, i really love this project, i have a little question (i dont know if is a bug or is my fault)

i notice if i apply colors to the text when create the file on https://yarnspinnertool.github.io/YarnEditor/

when read the file in my app then this crash. i am missing something?

(sorry my bad engish)

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.