Hey, I like to convert my Squiffy story (simple Gamebook) to an ePub Ebook.
Is there a way to use simple Boolean variables in an ebook?
I like to save some status in that variables that will be used be if clauses to navigate.
I think there's some EPUB readers that allow javascript, but the last time I checked it wasn't part of the standard.
My solution for EPUB and MOBI gamebooks:
If you're only using booleans, you could create 2 copies of each section: one with a boolean true, and one false. On the sections that change the boolean, you link to the 'true' version. Remove any versions you don't need (like the 'false' versions of any sections that are only reachable when it's true, and vice versa.
This can be a little time-consuming, but it shouldn't increase the size of the final book too much. I was writing a Perl script to automate it, but kind of distracted myself.
I have tried to convert a squiffy story to an epub a couple years ago. And I tried every single f*cking approach that could be used. Can´t be done.
In the end I coded an app for phone/android-ebook-reader heavily insipired in squiffy.
The solution propossed of several branches has a big problem: the user can manually navigate the book besides the choices propossed. I mean, if he reach a page with two paths, he can just press the forward page button and get the next section (even if it is not one of the two ways presented) and so on, and so on. And also the size of the book goes nut.
I mean, if he reach a page with two paths, he can just press the forward page button and get the next section
It may be possible to work around that behaviour using linear="no"
on some readers, or footnote markup. I've seen books where translation notes are in a separate document which is only reachable by clicking a link to them, and don't show up in the TOC or linear navigation.
But if you're converting a story to EPUB, you probably have to live with this possibility. I don't see that it's a big deal; you could do that in printed gamebooks too, but most readers don't because it's kind of pointless. And if the reader wants to, I don't see why I should care. It's like people who read the back page first on a murder mystery, so they can be watching out for the clues. They know it's not how you're supposed to read the story, they're not going to complain if that makes them enjoy it less, but if they've bought the book I think they can enjoy it however they prefer.
And also the size of the book goes nut.
Compared to what?
a ~100 page book with a small number of booleans can easily expand to ~500 pages after optimisation, and that's huge. But the xhtml files are still smaller than a single photograph. And because the text in many of those sections is the same, the file compresses extremely well. The duplicated sections are unlikely to make a noticeable difference to the final EPUB file.
If you have a large number of variables, it might be necessary to handle it using a different format. But I think for most CYOA-type stories, it should be possible.
Hmmmm…
Thats Not comfortable, but maybe working.
Thought that epub3 could handle that stuff, but can’t find any sources for proofing…