Any way to flash the DAM file to the Choosatron?


#1

I’m in the middle of writing several stories. Some which are on hold until the Choosatron Write software matures more, others I can work on now. However, I’d really like to test the stories out on the Choosatron itself.

Is there a way I can flash my own stories via the command line to the Choosatron ? I realise it would wipe out the existing stories on there, and I’m fine with that (I can always add them back again).

Please @jerrytron, tell me it’s possible :slight_smile:


#2

I guess not…
20char limit


#3

I don’t know how you knew I was JUST looking at this question (I know I’m always behind, been a tough week). Actually, yes, it IS possible. I’m putting it on my TODO list to provide the the code / info needed to do so. It’s tough trying to balance time into getting the new, nicely wrapped stuff working versus sharing / explaining the hacky solutions used for testing. Basically it involves installing the sz tool, which on OSX is just: brew install lrzsz

It allows you to transfer a file using the ymodem protocol (which is how the Choosatron accepts a story file). There are a few other bytes to need to prepend in order to appease the Choosatron (to tell it you plan on sending a story, the position in the list of stories, file size…). So that exists. There is getting a compiled Choosatron story binary of course, which can be done from a Twine source file with some gross Python scripts I have (without getting into the writing app).

Of course, the OTHER way to deal with this, is (once you have a compiled story file) putting your story on an SD card inside the Choosatron. If you hold down button ‘2’ on boot it will look to the SD card instead of internal memory. You can also flip an internal flag to change the default (whether it looks at internal memory or the SD card UNLESS you hold ‘2’). This is easy to set with a CURL command.

So, I can get the python scripts / examples uploaded for you to generate story binaries in the meantime (this won’t take me much time at all). Then, depending on what you would prefer in the short term, I can get a tutorial up for transferring a story over serial, or a tutorial on using the SD card slot. Any preference on where I put that time?


#4

Here, let me get you at least part-way there with a way to easily compile a binary. Seriously though, this python code has been repurposed so many times it isn’t even funny. I use other tools to verify binary integrating, this was just a fast way to push out a story binary I could parse. Python Choosatron Story Binary Builder

Test it out with the included story first to make sure it works at all. :slight_smile: Let me know which transfer method you’d prefer some short term instructions on. The SD method (micro-SD card) is non-destructive, so you can essentially have two entirely different sets of stories in a Choosatron at the same time.


#5

I’ll do the SD method (I honestly forgot about the microSD slot on the Choosatron), as it allows me to play with several stories at the same time.

I presume if I’m using a DAM file I’d use the cdam_gen_files.py or .pyc file? Time to give it a go and see what happens :smile:

Is there a way to PM files here ? I’d rather not post my story here, only because in order to keep track of the character, I’m using a ref code, which would make it easy for people to figure out the pattern. So if I can’t get it working, I’d like to be able to pm you the file to test, if possible ?


#6

Ok, the .dam file is the binary file. Copying that to the SD card and holding down ‘2’ allowed it to boot to my story, which is really cool.

Except one massive problem. I use an appended passage right at the beginning (passage 1 == intro, passage 2 == story continuation allowing me to reference passage 2 from other parts of the story without starting again). Passage 2 is appended to passage 1. The problem: Those passages aren’t linked in either the the HTML output nor the .dam file.

So the Choosatron plays passage 1 and then ends :frowning: That’s a bit of a bummer.

I’ve been using the export from the Write software to generate the .dam file, so I might try the python script with the json file and see if it makes a difference.

Edit: I’m getting this error using the script to convert the .json file:

Traceback (most recent call last):
  File "C:\Users\Slade\Downloads\ChoosatronBinaries\cdam_gen_files.py", line 957
, in <module>
    main()
  File "C:\Users\Slade\Downloads\ChoosatronBinaries\cdam_gen_files.py", line 95,
 in main
    gen.CreatePassageFile(jsonMap[key], filepath, args.update, args.force)
TypeError: CreatePassageFile() takes at least 6 arguments (5 given)

#7

Hi I’ve been trying to get the SD Card method mentioned above to work, but am having no luck. I hold down the “2” button when powering up the Choosatron, but it keeps booting to the onboard stories not the SD Card.

The SD Card is a 64MB FAT formatted card, with a single test story.dam file (Exported from the Choosatron Write app).

Is there something obvious I’m missing?

Cheers
Tim


#8

I presume you mean 64Gb ?

I’m only using a 4Gb, so I can’t say whether that’s the problem. It may well be that the Choosatron can only read 32Gb cards max. If you have a smaller card, I’d suggest you try that first.

Secondly, I hold down the ‘2’ button until I see ‘Press any button to start!’. At that point I know the Choosatron has booted fully and is ready to play a story. I make sure I press the button before I plug the power in.

Try the following file. It’s the Cinderella story I wrote a while back. It works fine on my Choosatron.

Download


#9

Thanks Rodney for the quick reply.

It actually is only a 64MB card, it’s just the first one I could lay my hands on around the house. Think it came from a camera about 10 years ago! Although maybe the issue is the size, just a case of it’s too small to be noticed rather than too big!

I do have a 4GB card so I will format that and try it out with both my story and yours.

In relation to booting the Choosatron that’s exactly how I did it (hold down the “2” key, plug power, wait for the “Press any key” message). As soon as I release the “2” button though, the usual story options appear.

As I said I’ll try with my 4GB card and your working story and report back in half an hour or so

Cheers
Tim


#10

Hi again, reporting back to say it was indeed the 64MB SD card that seems to have been the problem. I put the stories on a 4GB card and it happily loaded stories up when I held down the “2” button on boot.

My kids are going to lose their sh*t (pardon the expression!) when I tell them they can now put their own stories on the Choosatron :smile:

Thanks for the advice!
Tim


#11

Hi Tim,

I’m glad that you got it working. It’s odd that a small card wouldn’t work. Usually SD readers have upper limits, not lower ones. You might try formatting it again, with a different cluster size (if available). Funnily enough, given the size of the .dam files, a 64MB card would hold quite a few stories.

Hopefully there will be a fix for the non working appended passages soon. I would really like to test my long story out on the Choosatron (70 passages and about 30% of the way through, with 8 endings so far).

If you have any stories, I’m sure we’d all like to read them. As for your children, I understand. I lost my marbles years ago, and never recovered them ! :stuck_out_tongue:

Have a great Easter.


#12

Cheers Rodney

I will try experimenting with the smaller SD cards (I turned up a 256MB one as well!). I initially thought the 64MB would be perfect for holding a load of stories, I think I’ll be hard-pressed to fill up a 4GB one!

The current stories I just loaded onto the Choosatron are very far from complete, it was really just to reassure myself that I would be able to get them on there without too much hassle, before committing the time to really flesh them out.

Can see lots of potential for the variable setting/testing features, but it seemed a little flaky on the Choosatron. Most likely due to errors in my story authoring though. I also hope to make use of the append feature, so like you hope to hear of that being resolved soon.

And I will definitely share any stories I manage to complete! For Verison 0.1 of the software I’m pretty impressed with what can be done with it already. (Thanks Jerry!)

Have a great Easter yourself.

Tim


#13

Of the two versions of Write I’ve compiled, I’m unable to have the Dev version generate the .dam file, whilst the normal version will (no idea why, I haven’t touched the code).

I haven’t played with the variables just yet. It’s something I want to do, but I wanted to test out a long story first. The software has issues I haven’t put on the bug tracker yet. Mostly if you notice it slowing down, exit back to the list of stories and go back in again. If it freezes for a fair few seconds, I can guarantee it hasn’t saved the last passage you’ve probably just written.

I’ve taken to writing the passages in Notepad and copy/pasting them into the passage windows. I’d also suggest using a grid reference system in order to track where your links come from and go to. I guess it all depends on how you write your stories. If you write all the way down one thread before back tracking to write down another or write each thread one step at a time.


#14

The Python scripts ONLY work on source files exported from Twine. It has no understanding of the JSON format from the new writing software. It is simply a legacy solution to create binaries from Twine. :confused:


#15

Honestly, to me it sounds like a bad card! Make sure it is FULLY formatted. No extra little files hanging around.

There is a hard limit of 20 stories on the Choosatron (after it reads in the first 20 available on an SD card it will stop looking, and internal memory it won’t let you put on more than that).

That can be very large stories however! Especially as new features are added like image support.


#16

I figured that out. Once I realised the .dam file could be copied directly to the microSD, I was happy.

That’s plenty. Especially if the stories are large ones, with a lot of passages. I’ve written around 80 passages in my most recent one, which is around 35% complete. Hopefully over the next few weeks I’ll finish it off. I want to write around 10 passages a day, although sometimes… The creative juices just don’t flow very well.

Thanks for your help.


#17

@Rodneyn, it sounds like the autosave feature on the app may be causing your problems (the slowdown issue.) It would still be great to have an issue filed for it, but in the meantime, to keep your headaches to a minimum, you may want to try editing your profile and disabling auto-save. You’ll have to manually hit the save icon, but it won’t drag down the app like it is for you now.


#18

Hey Rodney. I believe I’ve got the fix in for the append issue on Choosatron binaries (only binaries at the moment). Try exporting again (from the main branch) and see how it goes!


#19

@spleenboy, I will as soon as I know what steps I can do to reproduce it each time. It happens regularly, but I’m not paying attention to the actual steps and cause. I agree with the auto save being the culprit, because there are times the app won’t save the last passage, when it gets to that point. I’d guess it’s dropping into some sort of loop that’s not exiting properly.

@jerrytron, I’ll build another version soon and test it out. Thanks :slight_smile: I’m up to 100 passages on my 230+ passage epic. I can’t wait to finish it and let people read it (bring lots of paper).

Edit: It doesn’t work. I updated the files from the master branch, rebuilt the app, installed it, imported the story and exported it to a dam file (I love the name), stuck on the microSD and same thing. The story ends right at the end of the first passage. The appended passage never gets printed.


#20

Ok! @Rodneyn and @spleenboy: I have a real fix in. First, I fixed the issue on the dev branch keeping exporting from working. Was a simple error where a variable had it’s old name.

Second, the binary creation now properly checks for append, ending, or choices. If it’s append, it populates the choices with the single appropriate link as well as setting the append flag. I’ve tested this on a Choosatron and it works!

Since dev branch is able to export again, I’ll be focusing my changes there until we organize things a bit more.

Finally, I notice @Rodneyn that you immediately have a fun rhyme that carefully makes sure to stay within the 32 character line limit while printing. Congrats! You found a firmware bug. Word wrapping breaks if a line has 32 characters followed by a newline (a special case where it needs to be treated similarly to a space).