Does anybody know a way to automatically modify a plain text file like this:
Into the format where I could just paste it into a Twine array:
Any text or code editor that supports finding expressions should work for this. I'll use Notepad++ as an example.Go to Search > Replace... and at the bottom of the window you'll see a "Search Mode" section. Select "Regular expression" which will allow you to use special characters to detect certain elements, like ^ being the start of a line and $ being the end.If you're only doing a part of the file, you can either select the lines tick the "In selection" button or just cut and paste them into a new file to work with (I find using the "In selection" kinda finnicky personally).In the "Find what:" box, type ^ which will grab the start of each line. In the "Replace with:" box, type " so that each line will start with a quotation mark. Click "Replace All".Then find and replace the character $ with ", (quotation mark and a comma) which will add a quotation mark and a comma to the end of every line. Click "Replace All".Then just go to the last line and delete the final comma and add your declaration and brackets. Here's a video demonstration. Learning regular expressions is an extremely useful tool for anyone who works with code.
For things like that I tend to just build a macro in Notepad++.
In your example, I'd:
Notepad++ is a handy little tool for just about any developer's toolkit.