Narrator-Playdate : The Ink language parser and runtime implementationadapted to Playdate!

Hello all!

After looking and asking around here and everywhere, I took some time to adapt Narrator, a Ink runtime for Lua to playdate!

It is still VERY EARLY as I am testing it as I go and develop my own project (hopefully I'll make a devlog about it here at some point)

Have fun and send some love of the original author of the library!

11 Likes

Me and teammate have been talking about making a Ink parser when I saw this! We are going to try this, thanks for sharing! BTW, for some reason I was getting an error with the toybox add command but when I removed the final '/' from the link, it worked.

1 Like

Hi ZeAntwan, have you tested ink variables yet? I get this error whenever I use a variable.

PlaydateSimulator

Load failed, error: story.lua:606: bad argument #1 to 'insert' (table expected, got nil)
stack traceback:
	[C]: in function 'table.insert'
	story.lua:606: in method 'read_text'
	story.lua:527: in function <story.lua:422>
	(...tail calls...)
	story.lua:91: in method 'begin'
	main.lua:29: in main chunk
Update error: story.lua:606: bad argument #1 to 'insert' (table expected, got nil)
stack traceback:
	[C]: in function 'table.insert'
	story.lua:606: in method 'read_text'
	story.lua:527: in function <story.lua:422>
	(...tail calls...)
	story.lua:91: in method 'begin'
	main.lua:29: in main chunk

I'm using the example code you provided. The only edit I made was adding a variable "foo" in the beginning of game.ink. The ink file was parsed using astrochili's Narrator code (not through the defold project).

game.ink

VAR foo = 1
- I looked at Monsieur Fogg {foo}

EDIT
It seems that I fixed it. Stack was not being returned at the end of story:do_expression(expression) in story.lua

return self:manualExpression(expression), stack

But conditional choices don't work, which I believe is a known issue :frowning:

 * {test} [This is a choice!] -> choice1 // is not hidden when test is false

I'm having issue with my PC so it will unfortunately be hard for me to check, but I know my handling of expression and variables from ink is still very flawed (I had to comment a lot out of the original), but I remembered it working, so I might have broken it somehow...

I'll have a look at fixing it once I can run playdate code again !

However, Conditional choices "should" work, but you might need (for now at least) to but a more specific check like "test == true".

Likewise, I'll have a look at it as soon as I can... Sorry about that!