-
harlowe-macro-api
Adds an accessible, simplified framework to Harlowe for creating custom macros in JavaScript.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I'd recommend checking out "Chapel's Unofficial Custom Macro Framework for Harlowe", which includes the Harlowe.variables() method for setting Harlowe variables from JavaScript. (I don't even really know Harlowe, but that information wasn't hard for me to find.)
To the original poster, you can download that HTML file and import it into the Twine editor if you'd like to see the source code there. (NOTE: You may need to set the game's "Story Format" to SugarCube, since I'm using the latest version of SugarCube and you may not be.) I used a "Tetris" tag on the passage to indicate that the Tetris game should be played in that passage. Let me know if you have any questions on how to modify it.